14 lines
335 B
JavaScript
14 lines
335 B
JavaScript
![]() |
import { handleActions } from 'redux-actions';
|
||
|
import types from './types';
|
||
|
|
||
|
const initialState = [];
|
||
|
export default handleActions({
|
||
|
[types.makeToast]: (state, { payload: toast }) => [
|
||
|
...state,
|
||
|
toast
|
||
|
],
|
||
|
[types.removeToast]: (state, { payload: key }) => state.filter(
|
||
|
toast => toast.key !== key
|
||
|
)
|
||
|
}, initialState);
|