This commit is contained in:
18
node_modules/redux-notifications/src/reducer.js
generated
vendored
Normal file
18
node_modules/redux-notifications/src/reducer.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { NOTIF_SEND, NOTIF_DISMISS, NOTIF_CLEAR } from './actions';
|
||||
|
||||
export default function notifs(domain = [], action) {
|
||||
if (!action || !action.type) return domain;
|
||||
|
||||
switch (action.type) {
|
||||
case NOTIF_SEND:
|
||||
return [action.payload, ...domain.filter(({ id }) => id !== action.payload.id)];
|
||||
case NOTIF_DISMISS:
|
||||
return domain.filter(notif =>
|
||||
notif.id !== action.payload
|
||||
);
|
||||
case NOTIF_CLEAR:
|
||||
return [];
|
||||
default:
|
||||
return domain;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user