project redux store

This commit is contained in:
Delucse
2020-12-02 14:02:03 +01:00
parent a8e36a4f06
commit a30747c608
7 changed files with 190 additions and 61 deletions
+2
View File
@@ -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
});
+34
View File
@@ -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;
}
}