15 lines
478 B
JavaScript
15 lines
478 B
JavaScript
import { Map, List, fromJS } from "immutable"
|
|
|
|
const defaultState = Map({
|
|
"users": List(),
|
|
"stats": 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)),
|
|
}
|
|
|
|
export default (state = defaultState, action) =>
|
|
handlers[action.type] ? handlers[action.type](state, action) : state;
|