Clean up notifications reducer

pull/10616/head
Alex P 2018-03-13 19:03:51 -07:00 committed by Andrew Watkins
parent 14037fa89f
commit 9bf565d2f4
1 changed files with 9 additions and 7 deletions

View File

@ -4,13 +4,15 @@ export const initialState = []
export const notifications = (state = initialState, action) => {
switch (action.type) {
case 'PUBLISH_NOTIFICATION': {
const notification = {
...action.payload.notification,
id: uuid.v4(),
}
const newNotification = [notification]
// Hacky way to add the new notifcation to the front of the list
return [...newNotification, ...state]
const {notifcation} = action.payload
const publishedNotification = [
{
...notifcation,
id: uuid.v4(),
},
]
return [...publishedNotification, ...state]
}
case 'DISMISS_NOTIFICATION': {