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

posting node right way

This commit is contained in:
Fedor Katurov 2020-08-25 13:46:37 +07:00
parent 5b7c3f364d
commit 5b8f13755f

View file

@ -13,7 +13,7 @@ export const postNode = ({
node: INode; node: INode;
}): Promise<IResultWithStatus<INode>> => }): Promise<IResultWithStatus<INode>> =>
api api
.post(API.NODE.SAVE, { node }, configWithToken(access)) .post(API.NODE.SAVE, node, configWithToken(access))
.then(resultMiddleware) .then(resultMiddleware)
.catch(errorMiddleware); .catch(errorMiddleware);
@ -124,9 +124,9 @@ export const updateNodeTags = ({
id, id,
tags, tags,
access, access,
}: ReturnType<typeof nodeUpdateTags> & { access: string }): Promise< }: ReturnType<typeof nodeUpdateTags> & { access: string }): Promise<IResultWithStatus<{
IResultWithStatus<{ node: INode }> node: INode;
> => }>> =>
api api
.post(API.NODE.UPDATE_TAGS(id), { tags }, configWithToken(access)) .post(API.NODE.UPDATE_TAGS(id), { tags }, configWithToken(access))
.then(resultMiddleware) .then(resultMiddleware)
@ -135,9 +135,9 @@ export const updateNodeTags = ({
export const postNodeLike = ({ export const postNodeLike = ({
id, id,
access, access,
}: ReturnType<typeof nodeLike> & { access: string }): Promise< }: ReturnType<typeof nodeLike> & { access: string }): Promise<IResultWithStatus<{
IResultWithStatus<{ is_liked: INode['is_liked'] }> is_liked: INode['is_liked'];
> => }>> =>
api api
.post(API.NODE.POST_LIKE(id), {}, configWithToken(access)) .post(API.NODE.POST_LIKE(id), {}, configWithToken(access))
.then(resultMiddleware) .then(resultMiddleware)
@ -146,9 +146,9 @@ export const postNodeLike = ({
export const postNodeStar = ({ export const postNodeStar = ({
id, id,
access, access,
}: ReturnType<typeof nodeStar> & { access: string }): Promise< }: ReturnType<typeof nodeStar> & { access: string }): Promise<IResultWithStatus<{
IResultWithStatus<{ is_liked: INode['is_liked'] }> is_liked: INode['is_liked'];
> => }>> =>
api api
.post(API.NODE.POST_STAR(id), {}, configWithToken(access)) .post(API.NODE.POST_STAR(id), {}, configWithToken(access))
.then(resultMiddleware) .then(resultMiddleware)
@ -158,9 +158,9 @@ export const postNodeLock = ({
id, id,
is_locked, is_locked,
access, access,
}: ReturnType<typeof nodeLock> & { access: string }): Promise< }: ReturnType<typeof nodeLock> & { access: string }): Promise<IResultWithStatus<{
IResultWithStatus<{ deleted_at: INode['deleted_at'] }> deleted_at: INode['deleted_at'];
> => }>> =>
api api
.post(API.NODE.POST_LOCK(id), { is_locked }, configWithToken(access)) .post(API.NODE.POST_LOCK(id), { is_locked }, configWithToken(access))
.then(resultMiddleware) .then(resultMiddleware)
@ -171,9 +171,10 @@ export const postNodeLockComment = ({
is_locked, is_locked,
current, current,
access, access,
}: ReturnType<typeof nodeLockComment> & { access: string; current: INode['id'] }): Promise< }: ReturnType<typeof nodeLockComment> & {
IResultWithStatus<{ deleted_at: INode['deleted_at'] }> access: string;
> => current: INode['id'];
}): Promise<IResultWithStatus<{ deleted_at: INode['deleted_at'] }>> =>
api api
.post(API.NODE.POST_LOCK_COMMENT(current, id), { is_locked }, configWithToken(access)) .post(API.NODE.POST_LOCK_COMMENT(current, id), { is_locked }, configWithToken(access))
.then(resultMiddleware) .then(resultMiddleware)