| 1 |
export const initialState = { |
| 2 |
user_data: undefined, |
| 3 |
user_page: undefined, |
| 4 |
groups_data: undefined, |
| 5 |
groups_page: undefined, |
| 6 |
limit: window.api_page_limit || 100, |
| 7 |
}; |
| 8 |
|
| 9 |
export const reducers = (state = initialState, action) => { |
| 10 |
switch (action.type) { |
| 11 |
// Updates the client user model data and stores the page |
| 12 |
case "USER_PAGE": |
| 13 |
return Object.assign({}, state, { |
| 14 |
user_page: action.value.page, |
| 15 |
user_data: action.value.data, |
| 16 |
}); |
| 17 |
|
| 18 |
case "GROUPS_PAGE": |
| 19 |
return Object.assign({}, state, { |
| 20 |
groups_page: action.value.page, |
| 21 |
groups_data: action.value.data, |
| 22 |
}); |
| 23 |
|
| 24 |
default: |
| 25 |
return state; |
| 26 |
} |
| 27 |
}; |