[ABANDONED] React/Redux front end for the Flexor social network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

28 lines
862 B

import { Reducer } from 'redux'
import { NotificationActions } from '../actions/notifications'
import { NotificationsState } from '../types'
const initialState: NotificationsState = []
const reducer: Reducer<NotificationsState, NotificationActions> = (state = initialState, action) => {
switch (action.type) {
case 'NOTIFICATIONS_SET_AUTO':
return state.map(notification => {
if (notification.id === action.payload.id) {
return {
...notification,
auto: false,
}
}
return notification
})
case 'NOTIFICATIONS_DISMISS':
return state.filter(notification => notification.id !== action.payload.id)
default:
return state
}
}
export default reducer