diff options
Diffstat (limited to 'src/reducers')
| -rw-r--r-- | src/reducers/index.js | 10 | ||||
| -rw-r--r-- | src/reducers/projects.js | 42 |
2 files changed, 52 insertions, 0 deletions
diff --git a/src/reducers/index.js b/src/reducers/index.js new file mode 100644 index 00000000..3974ce4a --- /dev/null +++ b/src/reducers/index.js @@ -0,0 +1,10 @@ +import {combineReducers} from "redux"; +import {authorizations, authVisibilityFilter, newProjectModalVisible} from "./projects"; + +const rootReducer = combineReducers({ + authorizations, + newProjectModalVisible, + authVisibilityFilter, +}); + +export default rootReducer; diff --git a/src/reducers/projects.js b/src/reducers/projects.js new file mode 100644 index 00000000..20f17a3c --- /dev/null +++ b/src/reducers/projects.js @@ -0,0 +1,42 @@ +import { + ADD_PROJECT, + CLOSE_NEW_PROJECT_MODAL, + OPEN_NEW_PROJECT_MODAL, + SET_AUTH_VISIBILITY_FILTER +} from "../actions/projects"; + +export const authorizations = (state = [], action) => { + switch (action.type) { + case ADD_PROJECT: + return [ + ...state, + { + userId: -1, + simulation: {name: action.name, datetimeLastEdited: "2017-08-06T12:43:00"}, + authorizationLevel: "OWN" + } + ]; + default: + return state; + } +}; + +export const newProjectModalVisible = (state = false, action) => { + switch (action.type) { + case OPEN_NEW_PROJECT_MODAL: + return true; + case CLOSE_NEW_PROJECT_MODAL: + return false; + default: + return state; + } +}; + +export const authVisibilityFilter = (state = "SHOW_ALL", action) => { + switch (action.type) { + case SET_AUTH_VISIBILITY_FILTER: + return action.filter; + default: + return state; + } +}; |
