1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-05-03 08:36:41 +07:00

search load more

This commit is contained in:
Fedor Katurov 2020-04-18 18:07:39 +07:00
parent 94ac596b92
commit 9498c7b7a0
12 changed files with 199 additions and 26 deletions
src/redux/flow

View file

@ -2,6 +2,7 @@ import { api, configWithToken, resultMiddleware, errorMiddleware } from '~/utils
import { INode, IResultWithStatus } from '../types';
import { API } from '~/constants/api';
import { flowSetCellView } from '~/redux/flow/actions';
import { IFlowState } from './reducer';
export const postNode = ({
access,
@ -30,11 +31,12 @@ export const postCellView = ({
export const getSearchResults = ({
access,
text,
}: {
skip = 0,
}: IFlowState['search'] & {
access: string;
text: string;
skip: number;
}): Promise<IResultWithStatus<{ nodes: INode[]; total: number }>> =>
api
.get(API.SEARCH, configWithToken(access, { params: { text } }))
.get(API.SEARCH.NODES, configWithToken(access, { params: { text, skip } }))
.then(resultMiddleware)
.catch(errorMiddleware);