From aa62dcfbcd992e783c4a90343d5cf0a3fd816acb Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Wed, 26 Aug 2020 13:15:10 +0700 Subject: [PATCH] fixed social account settings role buttons --- src/components/profile/ProfileAccounts/index.tsx | 16 ++++++++++++++-- src/constants/errors.ts | 2 ++ src/redux/node/sagas.ts | 5 +++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/components/profile/ProfileAccounts/index.tsx b/src/components/profile/ProfileAccounts/index.tsx index 4c20543f..cc4c80d8 100644 --- a/src/components/profile/ProfileAccounts/index.tsx +++ b/src/components/profile/ProfileAccounts/index.tsx @@ -122,11 +122,23 @@ const ProfileAccountsUnconnected: FC = ({ )} - - diff --git a/src/constants/errors.ts b/src/constants/errors.ts index 5256fb01..33bbc08a 100644 --- a/src/constants/errors.ts +++ b/src/constants/errors.ts @@ -35,6 +35,7 @@ export const ERRORS = { USER_EXIST_WITH_SOCIAL: 'User_Exist_With_Social', USER_EXIST_WITH_USERNAME: 'User_Exist_With_Username', CANT_SAVE_COMMENT: 'CantSaveComment', + CANT_SAVE_NODE: 'CantSaveNode', }; export const ERROR_LITERAL = { @@ -75,4 +76,5 @@ export const ERROR_LITERAL = { [ERRORS.USER_EXIST_WITH_SOCIAL]: 'У кого-то уже привязан этот аккаунт', [ERRORS.USER_EXIST_WITH_USERNAME]: 'Имя пользователя занято', [ERRORS.CANT_SAVE_COMMENT]: 'Не удалось сохранить коммент', + [ERRORS.CANT_SAVE_NODE]: 'Не удалось сохранить пост', }; diff --git a/src/redux/node/sagas.ts b/src/redux/node/sagas.ts index d1bc6412..c67720b3 100644 --- a/src/redux/node/sagas.ts +++ b/src/redux/node/sagas.ts @@ -82,6 +82,7 @@ function* onNodeSave({ node }: ReturnType) { yield put(nodeSetSaveErrors({})); const { + error, data: { errors, node: result }, } = yield call(reqWrapper, postNode, { node }); @@ -89,8 +90,8 @@ function* onNodeSave({ node }: ReturnType) { return yield put(nodeSetSaveErrors(errors)); } - if (!result || !result.id) { - return yield put(nodeSetSaveErrors({ error: ERRORS.EMPTY_RESPONSE })); + if (error || !result || !result.id) { + return yield put(nodeSetSaveErrors({ error: error || ERRORS.CANT_SAVE_NODE })); } const nodes = yield select(selectFlowNodes);