mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
flow redux
This commit is contained in:
parent
9691504af6
commit
95443635b4
11 changed files with 118 additions and 10 deletions
25
src/redux/flow/api.ts
Normal file
25
src/redux/flow/api.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { api, configWithToken, resultMiddleware, errorMiddleware } from '~/utils/api';
|
||||
import { INode, IResultWithStatus } from '../types';
|
||||
import { API } from '~/constants/api';
|
||||
|
||||
export const postNode = ({
|
||||
access,
|
||||
node,
|
||||
}: {
|
||||
access: string;
|
||||
node: INode;
|
||||
}): Promise<IResultWithStatus<INode>> =>
|
||||
api
|
||||
.post(API.NODE.SAVE, { node }, configWithToken(access))
|
||||
.then(resultMiddleware)
|
||||
.catch(errorMiddleware);
|
||||
|
||||
export const getNodes = ({
|
||||
skip = 0,
|
||||
}: {
|
||||
skip: number;
|
||||
}): Promise<IResultWithStatus<{ nodes: INode[] }>> =>
|
||||
api
|
||||
.get(API.NODE.GET, { params: { skip } })
|
||||
.then(resultMiddleware)
|
||||
.catch(errorMiddleware);
|
Loading…
Add table
Add a link
Reference in a new issue