project redux store
This commit is contained in:
@@ -3,12 +3,14 @@ import workspaceReducer from './workspaceReducer';
|
||||
import tutorialReducer from './tutorialReducer';
|
||||
import tutorialBuilderReducer from './tutorialBuilderReducer';
|
||||
import generalReducer from './generalReducer';
|
||||
import projectReducer from './projectReducer';
|
||||
import messageReducer from './messageReducer';
|
||||
|
||||
export default combineReducers({
|
||||
workspace: workspaceReducer,
|
||||
tutorial: tutorialReducer,
|
||||
builder: tutorialBuilderReducer,
|
||||
project: projectReducer,
|
||||
general: generalReducer,
|
||||
message: messageReducer
|
||||
});
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import { PROJECT_PROGRESS, GET_PROJECT, GET_PROJECTS, PROJECT_TYPE } from '../actions/types';
|
||||
|
||||
const initialState = {
|
||||
projects: [],
|
||||
type: '',
|
||||
progress: false
|
||||
};
|
||||
|
||||
export default function (state = initialState, action) {
|
||||
switch (action.type) {
|
||||
case PROJECT_PROGRESS:
|
||||
return {
|
||||
...state,
|
||||
progress: !state.progress
|
||||
}
|
||||
case GET_PROJECTS:
|
||||
return {
|
||||
...state,
|
||||
projects: action.payload
|
||||
};
|
||||
case GET_PROJECT:
|
||||
return {
|
||||
...state,
|
||||
projects: [action.payload]
|
||||
}
|
||||
case PROJECT_TYPE:
|
||||
return {
|
||||
...state,
|
||||
type: action.payload
|
||||
}
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user