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:
parent
c541278686
commit
76a3331719
14 changed files with 148 additions and 26 deletions
src/redux/node
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue