get a tutorial about the API
This commit is contained in:
@@ -3,10 +3,12 @@ import workspaceReducer from './workspaceReducer';
|
||||
import tutorialReducer from './tutorialReducer';
|
||||
import tutorialBuilderReducer from './tutorialBuilderReducer';
|
||||
import generalReducer from './generalReducer';
|
||||
import messageReducer from './messageReducer';
|
||||
|
||||
export default combineReducers({
|
||||
workspace: workspaceReducer,
|
||||
tutorial: tutorialReducer,
|
||||
builder: tutorialBuilderReducer,
|
||||
general: generalReducer
|
||||
general: generalReducer,
|
||||
message: messageReducer
|
||||
});
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { GET_ERRORS, CLEAR_MESSAGES, GET_SUCCESS } from '../actions/types';
|
||||
|
||||
const initialState = {
|
||||
msg: {},
|
||||
status: null,
|
||||
id: null
|
||||
};
|
||||
|
||||
export default function(state = initialState, action){
|
||||
switch(action.type){
|
||||
case GET_ERRORS:
|
||||
case GET_SUCCESS:
|
||||
return {
|
||||
msg: action.payload.msg,
|
||||
status: action.payload.status,
|
||||
id: action.payload.id
|
||||
};
|
||||
case CLEAR_MESSAGES:
|
||||
return {
|
||||
msg: {},
|
||||
status: null,
|
||||
id: null
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TUTORIAL_SUCCESS, TUTORIAL_ERROR, TUTORIAL_CHANGE, TUTORIAL_XML, TUTORIAL_ID, TUTORIAL_STEP } from '../actions/types';
|
||||
import { TUTORIAL_PROGRESS, GET_TUTORIAL, TUTORIAL_SUCCESS, TUTORIAL_ERROR, TUTORIAL_CHANGE, TUTORIAL_XML, TUTORIAL_ID, TUTORIAL_STEP } from '../actions/types';
|
||||
|
||||
import tutorials from '../data/tutorials';
|
||||
|
||||
@@ -40,14 +40,26 @@ const initialStatus = () => {
|
||||
|
||||
const initialState = {
|
||||
status: initialStatus(),
|
||||
currentId: null,
|
||||
// currentId: null,
|
||||
currentIndex: null,
|
||||
activeStep: 0,
|
||||
change: 0
|
||||
change: 0,
|
||||
tutorial: {},
|
||||
progress: false
|
||||
};
|
||||
|
||||
export default function (state = initialState, action) {
|
||||
switch (action.type) {
|
||||
case TUTORIAL_PROGRESS:
|
||||
return {
|
||||
...state,
|
||||
progress: !state.progress
|
||||
}
|
||||
case GET_TUTORIAL:
|
||||
return {
|
||||
...state,
|
||||
tutorial: action.payload
|
||||
};
|
||||
case TUTORIAL_SUCCESS:
|
||||
case TUTORIAL_ERROR:
|
||||
case TUTORIAL_XML:
|
||||
@@ -65,7 +77,7 @@ export default function (state = initialState, action) {
|
||||
case TUTORIAL_ID:
|
||||
return {
|
||||
...state,
|
||||
currentId: action.payload,
|
||||
// currentId: action.payload,
|
||||
currentIndex: tutorials.findIndex(tutorial => tutorial.id === action.payload)
|
||||
}
|
||||
case TUTORIAL_STEP:
|
||||
|
||||
Reference in New Issue
Block a user