Render Hikes questions

This commit is contained in:
Berkeley Martinez
2016-02-04 15:03:05 -08:00
parent ac32912cd5
commit f150b31c24
8 changed files with 48 additions and 32 deletions

View File

@@ -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

View File

@@ -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 }),