From 1230555006fb73ed52853f1aed1b77d7339f6c55 Mon Sep 17 00:00:00 2001 From: Ashesh3 <3626859+Ashesh3@users.noreply.github.com> Date: Fri, 6 Oct 2023 10:55:06 +0530 Subject: [PATCH] fix response status check --- src/Components/Auth/Login.tsx | 2 +- src/Components/Auth/ResetPassword.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Components/Auth/Login.tsx b/src/Components/Auth/Login.tsx index dd6a42d3983..140a0013fd9 100644 --- a/src/Components/Auth/Login.tsx +++ b/src/Components/Auth/Login.tsx @@ -151,7 +151,7 @@ export const Login = (props: { forgot?: boolean }) => { body: { ...valid }, }); setLoading(false); - if (res && res.statusText === "OK") { + if (res?.ok) { Notification.Success({ msg: t("password_sent"), }); diff --git a/src/Components/Auth/ResetPassword.tsx b/src/Components/Auth/ResetPassword.tsx index 2f02737f6de..74e37560515 100644 --- a/src/Components/Auth/ResetPassword.tsx +++ b/src/Components/Auth/ResetPassword.tsx @@ -72,7 +72,7 @@ export const ResetPassword = (props: any) => { const { res, error } = await request(routes.resetPassword, { body: { ...valid }, }); - if (res && res.statusText === "OK") { + if (res?.ok) { localStorage.removeItem(LocalStorageKeys.accessToken); Notification.Success({ msg: t("password_reset_success"), @@ -89,7 +89,7 @@ export const ResetPassword = (props: any) => { const { res } = await request(routes.checkResetToken, { body: { token: props.token }, }); - if (!res || res.statusText !== "OK") { + if (!res || res.ok) { navigate("/invalid-reset"); } };