Fix DataCenter emission calculation: VM-level processing, authentication fixes, and type safety improvements
This commit is contained in:
39
sge-frontend/src/redux/reducers/notifications/index.js
Normal file
39
sge-frontend/src/redux/reducers/notifications/index.js
Normal file
@@ -0,0 +1,39 @@
|
||||
const initialState = {
|
||||
getQuickNotifications: [],
|
||||
totalForQuick: 0,
|
||||
notifications: [],
|
||||
};
|
||||
|
||||
const notificationsReducer = (state = initialState, action) => {
|
||||
switch (action.type) {
|
||||
case "GET_QUICKNOTIFICATIONS":
|
||||
return {
|
||||
...state,
|
||||
getQuickNotifications: action.payload.getQuickNotifications,
|
||||
totalForQuick: action.payload.getQuickNotifications.filter(
|
||||
(notification) => notification.read === false
|
||||
).length,
|
||||
};
|
||||
|
||||
case "GET_SETNOTIFICATIONREAD":
|
||||
return {
|
||||
...state,
|
||||
setNotificationRead: action.payload.setNotificationRead,
|
||||
//totalForQuick: state.totalForQuick >= 1 ? state.totalForQuick - 1 : 0,
|
||||
};
|
||||
|
||||
case "GET_ALLNOTIFICATION":
|
||||
return {
|
||||
...state,
|
||||
notifications: action.payload.getAllNotifications,
|
||||
};
|
||||
|
||||
case "GET_NOTIFICATIONREMOVE":
|
||||
return {
|
||||
...state,
|
||||
notificationRemove: action.payload.notificationRemove,
|
||||
};
|
||||
}
|
||||
return state;
|
||||
};
|
||||
export default notificationsReducer;
|
||||
Reference in New Issue
Block a user