blob: e0749197bd9e7a9b8b111d0d57667126d78979a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
/**
* Internal dependencies
*/
import { CREATE_NOTICE, REMOVE_NOTICE } from './actions';
const notices = ( state = { notices: [] }, action ) => {
switch ( action.type ) {
case CREATE_NOTICE:
return {
...state,
notices: [ ...state.notices, action.notice ],
};
case REMOVE_NOTICE:
return {
...state,
notices: state.notices.filter( notice => notice.id !== action.notice.id ),
};
}
return state;
};
export default notices;
|