From b91ff984913854afed8f398ea5a85fa5256c6a7c Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Fri, 5 Mar 2021 09:22:21 +0700 Subject: [PATCH] fixed api call for code request --- src/redux/auth/api.ts | 7 +++---- src/redux/auth/sagas.ts | 4 ++-- src/redux/node/api.ts | 12 ------------ 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/redux/auth/api.ts b/src/redux/auth/api.ts index 25f38508..02869974 100644 --- a/src/redux/auth/api.ts +++ b/src/redux/auth/api.ts @@ -42,11 +42,10 @@ export const apiAuthGetUpdates = ({ exclude_dialogs, last }: ApiAuthGetUpdatesRe export const apiUpdateUser = ({ user }: ApiUpdateUserRequest) => api.patch(API.USER.ME, user).then(cleanResult); -export const apiRequestRestoreCode = ({ field }): Promise> => +export const apiRequestRestoreCode = ({ field }: { field: string }) => api - .post(API.USER.REQUEST_CODE(), { field }) - .then(resultMiddleware) - .catch(errorMiddleware); + .post<{}>(API.USER.REQUEST_CODE(), { field }) + .then(cleanResult); export const apiCheckRestoreCode = ({ code }: ApiCheckRestoreCodeRequest) => api.get(API.USER.REQUEST_CODE(code)).then(cleanResult); diff --git a/src/redux/auth/sagas.ts b/src/redux/auth/sagas.ts index 728677d9..f0cbebd5 100644 --- a/src/redux/auth/sagas.ts +++ b/src/redux/auth/sagas.ts @@ -75,8 +75,8 @@ function* sendLoginRequestSaga({ username, password }: ReturnType api.post(API.NODE.SAVE, node).then(cleanResult); -export const getNodes = ({ - from, - access, -}: { - from?: string; - access: string; -}): Promise> => - api - .get(API.NODE.GET, configWithToken(access, { params: { from } })) - .then(resultMiddleware) - .catch(errorMiddleware); - export const getNodeDiff = ({ start, end,