From 58c65da1f0095b29a9453cd347eb425c03a53264 Mon Sep 17 00:00:00 2001 From: HOANGLAOTA Date: Fri, 12 Jul 2024 11:39:45 +0700 Subject: [PATCH] fix bug v3 --- src/_actions/users.js | 6 +++++- src/_containers/RegisterPage/CreateAccount/index.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/_actions/users.js b/src/_actions/users.js index f7e6ecc..5a7ef0a 100644 --- a/src/_actions/users.js +++ b/src/_actions/users.js @@ -36,8 +36,12 @@ function login(data, type = "", typeWeb) { return (dispatch) => { let url_call_api = "/login"; let method = "POST"; - return apiCaller(url_call_api, method, data, null, false).then( + return apiCaller(url_call_api, method, data, null, false, configConstants.API_URL_SETEST, true, true).then( async (data) => { + if(!data?.status) { + dispatch(alertActions.error({ 'message': typeof data?.msg === 'string' ? data?.msg : Object.values(data?.msg)?.join('\n'), 'screen': userConstants.SCREEN_LOGIN })); + return; + } let user = data; user.isLogin = true; dispatch({ diff --git a/src/_containers/RegisterPage/CreateAccount/index.js b/src/_containers/RegisterPage/CreateAccount/index.js index ee06e5e..fae8cce 100644 --- a/src/_containers/RegisterPage/CreateAccount/index.js +++ b/src/_containers/RegisterPage/CreateAccount/index.js @@ -60,7 +60,7 @@ const CreateAccount = () => { if (res.status) { dispatch(alertActions.success({ 'message': res?.msg, 'screen': userConstants.SCREEN_REGISTER })); } else { - dispatch(alertActions.error({ 'message': Object.values(res?.msg)?.join('\n'), 'screen': userConstants.SCREEN_REGISTER, isShowPopup: true })); + dispatch(alertActions.error({ 'message': typeof res?.msg === 'string' ? res?.msg : Object.values(res?.msg)?.join('\n'), 'screen': userConstants.SCREEN_REGISTER, isShowPopup: true })); } } catch (err) { dispatch(alertActions.error({ 'message': err, 'screen': userConstants.SCREEN_REGISTER, isShowPopup: true }));