Render Hikes questions
This commit is contained in:
@@ -4,10 +4,18 @@ import types from './types';
|
||||
// updateTitle(title: String) => Action
|
||||
export const updateTitle = createAction(types.updateTitle);
|
||||
|
||||
let id = 0;
|
||||
// makeToast({ type?: String, message: String, title: String }) => Action
|
||||
export const makeToast = createAction(
|
||||
types.makeToast,
|
||||
toast => toast.type ? toast : (toast.type = 'info', toast)
|
||||
toast => {
|
||||
id += 1;
|
||||
return {
|
||||
...toast,
|
||||
id,
|
||||
type: toast.type || 'info'
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
// fetchUser() => Action
|
||||
|
||||
@@ -10,10 +10,7 @@ export default handleActions(
|
||||
|
||||
[types.makeToast]: (state, { payload: toast }) => ({
|
||||
...state,
|
||||
toast: {
|
||||
...toast,
|
||||
id: state.toast && state.toast.id ? state.toast.id : 1
|
||||
}
|
||||
toast
|
||||
}),
|
||||
|
||||
[types.setUser]: (state, { payload: user }) => ({ ...state, ...user }),
|
||||
|
||||
Reference in New Issue
Block a user