Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/strapi-admin/admin/src/containers/NewNotification/ drwxr-xr-x | |
| Viewing file: Select action/file-type: import produce from 'immer';
import { get } from 'lodash';
import { SHOW_NEW_NOTIFICATION, HIDE_NEW_NOTIFICATION } from './constants';
const initialState = {
notifId: 0,
notifications: [],
};
const notificationReducer = (state = initialState, action) =>
// eslint-disable-next-line consistent-return
produce(state, draftState => {
switch (action.type) {
case SHOW_NEW_NOTIFICATION: {
draftState.notifications.push({
// No action.config spread to limit the notification API and avoid customization
id: state.notifId,
type: get(action, ['config', 'type'], 'success'),
message: get(action, ['config', 'message'], {
id: 'notification.success.saved',
defaultMessage: 'Saved',
}),
title: get(action, ['config', 'title'], null),
link: get(action, ['config', 'link'], null),
timeout: get(action, ['config', 'timeout'], 2500),
blockTransition: get(action, ['config', 'blockTransition'], false),
uid: get(action, ['config', 'uid'], null),
onClose: get(action, ['config', 'onClose'], null),
centered: get(action, ['config', 'centered'], false),
});
draftState.notifId = state.notifId + 1;
break;
}
case HIDE_NEW_NOTIFICATION: {
const indexToRemove = state.notifications.findIndex(notif => notif.id === action.id);
if (indexToRemove !== -1) {
draftState.notifications.splice(indexToRemove, 1);
}
break;
}
default: {
return draftState;
}
}
});
export default notificationReducer;
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0091 ]-- |