Grégoire Delattre c5cafacbf1 Update everything to work with the new router
By the way, remove the router state from redux.
2019-05-19 02:31:25 +02:00

17 lines
619 B
JavaScript

import { Map, List, fromJS } from "immutable"
export const defaultState = Map({
"users": List(),
"stats": Map({}),
"modules": Map({}),
});
const handlers = {
"ADMIN_LIST_USERS_FULFILLED": (state, action) => state.set("users", fromJS(action.payload.response.data)),
"ADMIN_GET_STATS_FULFILLED": (state, action) => state.set("stats", fromJS(action.payload.response.data)),
"ADMIN_GET_MODULES_FULFILLED": (state, action) => state.set("modules", fromJS(action.payload.response.data)),
}
export default (state = defaultState, action) =>
handlers[action.type] ? handlers[action.type](state, action) : state;