1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-28 14:16:41 +07:00

node no comments

This commit is contained in:
muerwre 2019-08-25 21:56:32 +07:00
parent b4d7bd2c8a
commit 96bdbb0e04
11 changed files with 103 additions and 61 deletions

View file

@ -1,6 +1,11 @@
import assocPath from 'ramda/es/assocPath';
import { NODE_ACTIONS } from './constants';
import { nodeSetSaveErrors, nodeSetLoading, nodeSetCurrent } from './actions';
import {
nodeSetSaveErrors,
nodeSetLoading,
nodeSetCurrent,
nodeSetLoadingComments,
} from './actions';
import { INodeState } from './reducer';
const setSaveErrors = (state: INodeState, { errors }: ReturnType<typeof nodeSetSaveErrors>) =>
@ -9,11 +14,17 @@ const setSaveErrors = (state: INodeState, { errors }: ReturnType<typeof nodeSetS
const setLoading = (state: INodeState, { is_loading }: ReturnType<typeof nodeSetLoading>) =>
assocPath(['is_loading'], is_loading, state);
const setLoadingComments = (
state: INodeState,
{ is_loading_comments }: ReturnType<typeof nodeSetLoadingComments>
) => assocPath(['is_loading_comments'], is_loading_comments, state);
const setCurrent = (state: INodeState, { current }: ReturnType<typeof nodeSetCurrent>) =>
assocPath(['current'], current, state);
export const NODE_HANDLERS = {
[NODE_ACTIONS.SAVE]: setSaveErrors,
[NODE_ACTIONS.SET_LOADING]: setLoading,
[NODE_ACTIONS.SET_LOADING_COMMENTS]: setLoadingComments,
[NODE_ACTIONS.SET_CURRENT]: setCurrent,
};