Fix notifications reducer, fix provider notifications
This commit is contained in:
parent
351b2c8592
commit
4eb153bda7
|
@ -48,8 +48,10 @@ class Notifier extends Component<Props> {
|
|||
if (this.displayed.includes(notification.key)) {
|
||||
return
|
||||
}
|
||||
|
||||
// Display snackbar using notistack
|
||||
enqueueSnackbar(notification.message, {
|
||||
key: notification.key,
|
||||
...notification.options,
|
||||
onClose: (event, reason, key) => {
|
||||
if (notification.options.onClose) {
|
||||
|
|
|
@ -153,7 +153,6 @@ export const enhanceSnackbarForAction = (notification: Notification) => ({
|
|||
...notification.options,
|
||||
action: (key) => (
|
||||
<IconButton onClick={() => store.dispatch(closeSnackbarAction(key))}>
|
||||
{console.log(key, notification.message)}
|
||||
<IconClose />
|
||||
</IconButton>
|
||||
),
|
||||
|
|
|
@ -6,7 +6,7 @@ export type NotificationProps = {
|
|||
key?: number,
|
||||
message: string,
|
||||
options: Object,
|
||||
dismissed: boolean,
|
||||
dismissed?: boolean,
|
||||
}
|
||||
|
||||
export const makeNotification: RecordFactory<NotificationProps> = Record({
|
||||
|
|
|
@ -18,10 +18,9 @@ export default handleActions<NotificationReducerState, *>(
|
|||
return state.set(notification.key, makeNotification(notification))
|
||||
},
|
||||
[CLOSE_SNACKBAR]: (state: NotificationReducerState, action: ActionType<Function>): NotificationReducerState => {
|
||||
const { notification }: { notification: NotificationProps } = action.payload
|
||||
notification.dismissed = true
|
||||
const key = action.payload
|
||||
|
||||
return state.update(notification.key, (prev) => prev.merge(notification))
|
||||
return state.update(key, (prev) => prev.set('dismissed', true))
|
||||
},
|
||||
[REMOVE_SNACKBAR]: (state: NotificationReducerState, action: ActionType<Function>): NotificationReducerState => {
|
||||
const key = action.payload
|
||||
|
|
Loading…
Reference in New Issue