Clean up notifications reducer
parent
14037fa89f
commit
9bf565d2f4
|
@ -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': {
|
||||
|
|
Loading…
Reference in New Issue