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

getting node results for search

This commit is contained in:
Fedor Katurov 2020-04-18 16:06:10 +07:00
parent 41a35f1490
commit 94ac596b92
15 changed files with 308 additions and 164 deletions

View file

@ -1,46 +1,41 @@
import assocPath from "ramda/es/assocPath";
import { FLOW_ACTIONS } from "./constants";
import assocPath from 'ramda/es/assocPath';
import { FLOW_ACTIONS } from './constants';
import {
flowSetNodes,
flowSetHeroes,
flowSetRecent,
flowSetUpdated,
flowSetRange,
flowSetFlow
} from "./actions";
import { IFlowState } from "./reducer";
flowSetFlow,
flowSetSearch,
} from './actions';
import { IFlowState } from './reducer';
const setNodes = (
state: IFlowState,
{ nodes }: ReturnType<typeof flowSetNodes>
) => assocPath(["nodes"], nodes, state);
const setNodes = (state: IFlowState, { nodes }: ReturnType<typeof flowSetNodes>) =>
assocPath(['nodes'], nodes, state);
const setHeroes = (
state: IFlowState,
{ heroes }: ReturnType<typeof flowSetHeroes>
) => assocPath(["heroes"], heroes, state);
const setHeroes = (state: IFlowState, { heroes }: ReturnType<typeof flowSetHeroes>) =>
assocPath(['heroes'], heroes, state);
const setRecent = (
state: IFlowState,
{ recent }: ReturnType<typeof flowSetRecent>
) => assocPath(["recent"], recent, state);
const setRecent = (state: IFlowState, { recent }: ReturnType<typeof flowSetRecent>) =>
assocPath(['recent'], recent, state);
const setUpdated = (
state: IFlowState,
{ updated }: ReturnType<typeof flowSetUpdated>
) => assocPath(["updated"], updated, state);
const setUpdated = (state: IFlowState, { updated }: ReturnType<typeof flowSetUpdated>) =>
assocPath(['updated'], updated, state);
const setRange = (
state: IFlowState,
{ range }: ReturnType<typeof flowSetRange>
) => assocPath(["range"], range, state);
const setFlow = (state: IFlowState, { data }: ReturnType<typeof flowSetFlow>): IFlowState => ({
...state,
...data,
});
const setFlow = (
const setSearch = (
state: IFlowState,
{ data }: ReturnType<typeof flowSetFlow>
{ search }: ReturnType<typeof flowSetSearch>
): IFlowState => ({
...state,
...data
search: {
...state.search,
...search,
},
});
export const FLOW_HANDLERS = {
@ -48,6 +43,6 @@ export const FLOW_HANDLERS = {
[FLOW_ACTIONS.SET_HEROES]: setHeroes,
[FLOW_ACTIONS.SET_RECENT]: setRecent,
[FLOW_ACTIONS.SET_UPDATED]: setUpdated,
[FLOW_ACTIONS.SET_RANGE]: setRange,
[FLOW_ACTIONS.SET_FLOW]: setFlow
[FLOW_ACTIONS.SET_FLOW]: setFlow,
[FLOW_ACTIONS.SET_SEARCH]: setSearch,
};