* client: add link to the update error

This commit is contained in:
Ildar Kamalov
2019-05-17 18:17:17 +03:00
committed by Simon Zolin
parent 24f582d36d
commit 967517316f
5 changed files with 38 additions and 11 deletions

View File

@@ -1,7 +1,7 @@
import { handleActions } from 'redux-actions';
import nanoid from 'nanoid';
import { addErrorToast, addSuccessToast, removeToast } from '../actions';
import { addErrorToast, addSuccessToast, addNoticeToast, removeToast } from '../actions';
const toasts = handleActions({
[addErrorToast]: (state, { payload }) => {
@@ -24,6 +24,16 @@ const toasts = handleActions({
const newState = { ...state, notices: [...state.notices, successToast] };
return newState;
},
[addNoticeToast]: (state, { payload }) => {
const noticeToast = {
id: nanoid(),
message: payload.error.toString(),
type: 'notice',
};
const newState = { ...state, notices: [...state.notices, noticeToast] };
return newState;
},
[removeToast]: (state, { payload }) => {
const filtered = state.notices.filter(notice => notice.id !== payload);
const newState = { ...state, notices: filtered };