1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

flow redux

This commit is contained in:
muerwre 2019-08-24 17:58:39 +07:00
parent 9691504af6
commit 95443635b4
11 changed files with 118 additions and 10 deletions

View file

@ -2,14 +2,24 @@ import { api, configWithToken, resultMiddleware, errorMiddleware } from '~/utils
import { INode, IResultWithStatus } from '../types';
import { API } from '~/constants/api';
export const postNode = ({
export const postNode = ({
access,
node,
}: {
access: string,
node: INode,
}): Promise<IResultWithStatus<INode>> => (
api.post(API.NODE.SAVE, { node }, configWithToken(access))
access: string;
node: INode;
}): Promise<IResultWithStatus<INode>> =>
api
.post(API.NODE.SAVE, { node }, configWithToken(access))
.then(resultMiddleware)
.catch(errorMiddleware)
);
.catch(errorMiddleware);
export const getNodes = ({
skip = 0,
}: {
skip?: number;
}): Promise<IResultWithStatus<{ nodes: INode[] }>> =>
api
.get(API.NODE.GET, { params: { skip } })
.then(resultMiddleware)
.catch(errorMiddleware);