From 5b8f13755f2c01f7f61fe557bda8fb36a3ddba32 Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Tue, 25 Aug 2020 13:46:37 +0700 Subject: [PATCH] posting node right way --- src/redux/node/api.ts | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/redux/node/api.ts b/src/redux/node/api.ts index 634151c4..dc13ccc7 100644 --- a/src/redux/node/api.ts +++ b/src/redux/node/api.ts @@ -13,7 +13,7 @@ export const postNode = ({ node: INode; }): Promise> => api - .post(API.NODE.SAVE, { node }, configWithToken(access)) + .post(API.NODE.SAVE, node, configWithToken(access)) .then(resultMiddleware) .catch(errorMiddleware); @@ -124,9 +124,9 @@ export const updateNodeTags = ({ id, tags, access, -}: ReturnType & { access: string }): Promise< - IResultWithStatus<{ node: INode }> -> => +}: ReturnType & { access: string }): Promise> => api .post(API.NODE.UPDATE_TAGS(id), { tags }, configWithToken(access)) .then(resultMiddleware) @@ -135,9 +135,9 @@ export const updateNodeTags = ({ export const postNodeLike = ({ id, access, -}: ReturnType & { access: string }): Promise< - IResultWithStatus<{ is_liked: INode['is_liked'] }> -> => +}: ReturnType & { access: string }): Promise> => api .post(API.NODE.POST_LIKE(id), {}, configWithToken(access)) .then(resultMiddleware) @@ -146,9 +146,9 @@ export const postNodeLike = ({ export const postNodeStar = ({ id, access, -}: ReturnType & { access: string }): Promise< - IResultWithStatus<{ is_liked: INode['is_liked'] }> -> => +}: ReturnType & { access: string }): Promise> => api .post(API.NODE.POST_STAR(id), {}, configWithToken(access)) .then(resultMiddleware) @@ -158,9 +158,9 @@ export const postNodeLock = ({ id, is_locked, access, -}: ReturnType & { access: string }): Promise< - IResultWithStatus<{ deleted_at: INode['deleted_at'] }> -> => +}: ReturnType & { access: string }): Promise> => api .post(API.NODE.POST_LOCK(id), { is_locked }, configWithToken(access)) .then(resultMiddleware) @@ -171,9 +171,10 @@ export const postNodeLockComment = ({ is_locked, current, access, -}: ReturnType & { access: string; current: INode['id'] }): Promise< - IResultWithStatus<{ deleted_at: INode['deleted_at'] }> -> => +}: ReturnType & { + access: string; + current: INode['id']; +}): Promise> => api .post(API.NODE.POST_LOCK_COMMENT(current, id), { is_locked }, configWithToken(access)) .then(resultMiddleware)