They've changed their default settings, this changes a lot of stuff in our code base.
19 lines
485 B
JavaScript
19 lines
485 B
JavaScript
import { List, fromJS } from "immutable";
|
|
|
|
const defaultState = List();
|
|
|
|
const handlers = {
|
|
ADD_NOTIFICATION: (state, action) =>
|
|
state.push(
|
|
fromJS({
|
|
id: Math.random().toString(36).substring(7),
|
|
...action.payload,
|
|
})
|
|
),
|
|
REMOVE_NOTIFICATION: (state, action) =>
|
|
state.filter((e) => e.get("id") !== action.payload.id),
|
|
};
|
|
|
|
export default (state = defaultState, action) =>
|
|
handlers[action.type] ? handlers[action.type](state, action) : state;
|