summaryrefslogtreecommitdiff
path: root/src/reducers/simulations.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/reducers/simulations.js')
-rw-r--r--src/reducers/simulations.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/reducers/simulations.js b/src/reducers/simulations.js
new file mode 100644
index 00000000..5a34ee7f
--- /dev/null
+++ b/src/reducers/simulations.js
@@ -0,0 +1,44 @@
+import {
+ ADD_SIMULATION_SUCCEEDED,
+ CLOSE_NEW_SIMULATION_MODAL,
+ DELETE_SIMULATION,
+ OPEN_NEW_SIMULATION_MODAL,
+ SET_AUTH_VISIBILITY_FILTER
+} from "../actions/simulations";
+import {FETCH_AUTHORIZATIONS_OF_CURRENT_USER_SUCCEEDED} from "../actions/users";
+
+export function authorizationsOfCurrentUser(state = [], action) {
+ switch (action.type) {
+ case FETCH_AUTHORIZATIONS_OF_CURRENT_USER_SUCCEEDED:
+ return action.authorizationsOfCurrentUser;
+ case ADD_SIMULATION_SUCCEEDED:
+ return [
+ ...state,
+ action.authorization
+ ];
+ case DELETE_SIMULATION:
+ return [];
+ default:
+ return state;
+ }
+}
+
+export function newSimulationModalVisible(state = false, action) {
+ switch (action.type) {
+ case OPEN_NEW_SIMULATION_MODAL:
+ return true;
+ case CLOSE_NEW_SIMULATION_MODAL:
+ return false;
+ default:
+ return state;
+ }
+}
+
+export function authVisibilityFilter(state = "SHOW_ALL", action) {
+ switch (action.type) {
+ case SET_AUTH_VISIBILITY_FILTER:
+ return action.filter;
+ default:
+ return state;
+ }
+}