blob: 9d8308773a9329e5258303aa222eff88885f40aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
import {
ADD_SIMULATION_SUCCEEDED,
CLOSE_NEW_SIMULATION_MODAL,
DELETE_SIMULATION_SUCCEEDED,
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_SUCCEEDED:
return state.filter(authorization => authorization[1] !== action.id);
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;
}
}
|