From 4c01e575dff6de8ad5505a5808eaeda4eab29357 Mon Sep 17 00:00:00 2001 From: Akshata Katwal Date: Tue, 3 Dec 2024 17:46:13 +0530 Subject: [PATCH] Issue feat:Fix language selected issue upon change academic year --- src/components/layouts/header/Header.tsx | 16 +++++++++++++++- src/pages/edit-password.tsx | 15 ++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/components/layouts/header/Header.tsx b/src/components/layouts/header/Header.tsx index a65683ba..f7134ffb 100644 --- a/src/components/layouts/header/Header.tsx +++ b/src/components/layouts/header/Header.tsx @@ -90,7 +90,21 @@ const Header = ({ sx, customClass, toggleMobileSidebar, position }: any) => { const storedUserData = JSON.parse( localStorage.getItem("adminInfo") || "{}" ); - window.location.href = (storedUserData?.role === Role.SCTA || storedUserData?.role === Role.CCTA)?"/course-planner":"/centers"; + // window.location.href = (storedUserData?.role === Role.SCTA || storedUserData?.role === Role.CCTA)?"/course-planner":"/centers"; + const { locale } = router; + if(storedUserData?.role === Role.SCTA || storedUserData?.role === Role.CCTA) + { + if(locale) + router.push("/course-planner", undefined, { locale: locale }); + else + router.push("/course-planner"); + } + else{ + if(locale) + router.push("/centers", undefined, { locale: locale }); + else + router.push("/centers"); + } }; const handleChange = (event: SelectChangeEvent) => { diff --git a/src/pages/edit-password.tsx b/src/pages/edit-password.tsx index 1134f379..2489bef7 100644 --- a/src/pages/edit-password.tsx +++ b/src/pages/edit-password.tsx @@ -45,12 +45,21 @@ const EditForgotPassword = () => { const storedUserData = JSON.parse( localStorage.getItem("adminInfo") || "{}" ); + const { locale } = router; + if(storedUserData?.role === Role.SCTA || storedUserData?.role === Role.CCTA) { - router.push(`/course-planner`); - + if(locale) + router.push("/course-planner", undefined, { locale: locale }); + else + router.push("/course-planner"); }else - router.push(`/centers`); + { + if(locale) + router.push("/centers", undefined, { locale: locale }); + else + router.push("/centers"); + } localStorage.setItem('skipResetPassword', 'true'); };