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

adding comments

This commit is contained in:
muerwre 2019-08-26 15:37:11 +07:00
parent c541278686
commit 76a3331719
14 changed files with 148 additions and 26 deletions
src/redux/node

View file

@ -1,5 +1,5 @@
import { api, configWithToken, resultMiddleware, errorMiddleware } from '~/utils/api';
import { INode, IResultWithStatus } from '../types';
import { INode, IResultWithStatus, IComment } from '../types';
import { API } from '~/constants/api';
export const postNode = ({
@ -33,3 +33,17 @@ export const getNode = ({
.get(API.NODE.GET_NODE(id))
.then(resultMiddleware)
.catch(errorMiddleware);
export const postNodeComment = ({
id,
data,
access,
}: {
access: string;
id: number;
data: IComment;
}): Promise<IResultWithStatus<{ comment: Comment }>> =>
api
.post(API.NODE.COMMENT(id), data, configWithToken(access))
.then(resultMiddleware)
.catch(errorMiddleware);