From 5f5beacaab5c22f4a980f81f7c67f71e8731c105 Mon Sep 17 00:00:00 2001 From: karan Date: Tue, 6 Feb 2024 16:08:16 +0530 Subject: [PATCH 1/5] handled success navigation Signed-off-by: karan --- src/components/Authentication/KeyCloakResetPassword.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Authentication/KeyCloakResetPassword.tsx b/src/components/Authentication/KeyCloakResetPassword.tsx index fba55d0db..31d8dc257 100644 --- a/src/components/Authentication/KeyCloakResetPassword.tsx +++ b/src/components/Authentication/KeyCloakResetPassword.tsx @@ -9,6 +9,7 @@ import { passwordEncryption, resetPasswordKeyCloak } from '../../api/Auth'; import { PassInvisible, PassVisible } from './Svg.js'; import { pathRoutes } from '../../config/pathRoutes'; import type { IPassword, IProps, IValues } from './interfaces'; +import React from 'react'; const KeyClockResetPassword = (props: IProps) => { const [loading, setLoading] = useState(false); @@ -34,7 +35,7 @@ const KeyClockResetPassword = (props: IProps) => { if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { setSuccess(data.message); setLoading(false); - window.location.href = pathRoutes.landingPage.landingPage; + window.location.href= pathRoutes.auth.sinIn } else { setError(response as string); setLoading(false); From 82cb8e88f080ff0e7e1e8ccd84f7dac88835dca8 Mon Sep 17 00:00:00 2001 From: karan Date: Tue, 6 Feb 2024 16:45:55 +0530 Subject: [PATCH 2/5] handled ecosystem content change on dropdown Signed-off-by: karan --- src/commonComponents/EcosystemProfileCard.tsx | 1 - src/components/Resources/Schema/Create.tsx | 19 +++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/commonComponents/EcosystemProfileCard.tsx b/src/commonComponents/EcosystemProfileCard.tsx index 323ec5494..9a9b7518a 100644 --- a/src/commonComponents/EcosystemProfileCard.tsx +++ b/src/commonComponents/EcosystemProfileCard.tsx @@ -71,7 +71,6 @@ const EcosystemProfileCard = ({getEndorsementListData}:IEndorsement) => { await getEndorsementListData() } - useEffect(() => { fetchEcosystemDetails(); }, []); diff --git a/src/components/Resources/Schema/Create.tsx b/src/components/Resources/Schema/Create.tsx index b90ec4c53..56b34a2ed 100644 --- a/src/components/Resources/Schema/Create.tsx +++ b/src/components/Resources/Schema/Create.tsx @@ -70,19 +70,18 @@ const CreateSchema = () => { }, ], }; + const checkEcosystemData = async () => { + const data: ICheckEcosystem = await checkEcosystem(); + setIsEcosystemData(data); + }; + const [formData, setFormData] = useState(initFormData); + useEffect(() => { - const fetchData = async () => { + (async () => { const orgId = await getFromLocalStorage(storageKeys.ORG_ID); setOrgId(orgId); - }; - - fetchData(); - - const checkEcosystemData = async () => { - const data: ICheckEcosystem = await checkEcosystem(); - setIsEcosystemData(data); - }; + })(); checkEcosystemData(); }, []); @@ -283,7 +282,7 @@ const CreateSchema = () => { {isEcosystemData?.isEnabledEcosystem && (
- +
)} From 71ffec95d43700aea2de82f552dd4120f1b0894a Mon Sep 17 00:00:00 2001 From: karan Date: Tue, 6 Feb 2024 19:39:25 +0530 Subject: [PATCH 3/5] removed supabase dependency Signed-off-by: karan --- src/commonComponents/PasseyAddDevicePopup.tsx | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/commonComponents/PasseyAddDevicePopup.tsx b/src/commonComponents/PasseyAddDevicePopup.tsx index a80c7f30c..b5312a9fb 100644 --- a/src/commonComponents/PasseyAddDevicePopup.tsx +++ b/src/commonComponents/PasseyAddDevicePopup.tsx @@ -30,14 +30,6 @@ const PasskeyAddDevice = (props: { const savePassword = async (values: PasswordValue) => { try { const storedEmail = await getFromLocalStorage(storageKeys.LOGIN_USER_EMAIL); - const { error } = await getSupabaseClient().auth.signInWithPassword({ - email: storedEmail, - password: values.Password, - }); - if (error) { - setFidoUserError(error?.message) - - } else { const payload = { password: passwordEncryption(values.Password) } @@ -48,8 +40,6 @@ const PasskeyAddDevice = (props: { } else { setFidoUserError(passkeyUserDetailsResp as string) } - - } } catch (error) { console.error('An unexpected error occurred:', error.message); setFidoUserError('An unexpected error occurred') From 59351b2726810bc65b034d3e45a7da692da8f100 Mon Sep 17 00:00:00 2001 From: karan Date: Wed, 7 Feb 2024 12:11:11 +0530 Subject: [PATCH 4/5] fix: minor error Signed-off-by: karan --- src/components/Authentication/SignInUserPassword.tsx | 9 +++++++-- src/services/axiosIntercepter.ts | 8 +++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/components/Authentication/SignInUserPassword.tsx b/src/components/Authentication/SignInUserPassword.tsx index 612cb78ce..865292258 100644 --- a/src/components/Authentication/SignInUserPassword.tsx +++ b/src/components/Authentication/SignInUserPassword.tsx @@ -80,7 +80,7 @@ const SignInUserPassword = (signInUserProps: SignInUser3Props) => { setLoading(true); const loginRsp = await loginUser(payload); const { data } = loginRsp as AxiosResponse; - + if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { if (data?.data?.isRegisteredToSupabase) { setOpenModel(true); @@ -112,8 +112,13 @@ const SignInUserPassword = (signInUserProps: SignInUser3Props) => { } } else { setLoading(false); - setFailure(loginRsp as string); + if (loginRsp.toString().includes('401')) { + setFailure('Invalid Credntials'); + } else { + setFailure(loginRsp as string); + } } + setLoading(false); }; const handleBackButtonClick = () => { diff --git a/src/services/axiosIntercepter.ts b/src/services/axiosIntercepter.ts index 519db0ebf..084b23c6d 100644 --- a/src/services/axiosIntercepter.ts +++ b/src/services/axiosIntercepter.ts @@ -1,6 +1,8 @@ import axios from 'axios' import { envConfig } from '../config/envConfig'; import { pathRoutes } from '../config/pathRoutes'; +import { getFromLocalStorage } from '../api/Auth'; +import { storageKeys } from '../config/CommonConstant'; const instance = axios.create({ baseURL: envConfig.PUBLIC_BASE_URL @@ -21,8 +23,8 @@ instance.interceptors.response.use(function (response) { // Any status codes that falls outside the range of 2xx cause this function to trigger // Do something with response error const errorRes = error?.response; - - if(errorRes?.status === 401){ + const token = await getFromLocalStorage(storageKeys.TOKEN) + if(errorRes?.status === 401 && token){ await localStorage.clear() window.location.href = pathRoutes.auth.sinIn } @@ -30,4 +32,4 @@ instance.interceptors.response.use(function (response) { return Promise.reject(error); }); -export default instance \ No newline at end of file +export default instance From 06fb47b143a089137ee7c13b4a14e3a073154017 Mon Sep 17 00:00:00 2001 From: karan Date: Wed, 7 Feb 2024 12:30:18 +0530 Subject: [PATCH 5/5] handled alignment Signed-off-by: karan --- src/components/Authentication/KeyCloakResetPassword.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/Authentication/KeyCloakResetPassword.tsx b/src/components/Authentication/KeyCloakResetPassword.tsx index 31d8dc257..3269bfc44 100644 --- a/src/components/Authentication/KeyCloakResetPassword.tsx +++ b/src/components/Authentication/KeyCloakResetPassword.tsx @@ -180,9 +180,8 @@ const KeyClockResetPassword = (props: IProps) => { {formikHandlers?.errors?.newPassword && typeof formikHandlers?.errors?.newPassword === 'string' && - formikHandlers?.errors?.newPassword && formikHandlers?.touched?.newPassword && ( - + {formikHandlers?.errors?.newPassword} )}