From 64a61f37b45643f00a1ecf4afe94479a0e2c479b Mon Sep 17 00:00:00 2001 From: JoshLarouche Date: Mon, 26 Jun 2023 11:37:33 -0700 Subject: [PATCH] chore: refactoring some logicbased on review --- app/components/Layout/Navigation.tsx | 24 ++++++++++---------- app/components/Session/LoginForm.tsx | 33 +++++++++++++--------------- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/app/components/Layout/Navigation.tsx b/app/components/Layout/Navigation.tsx index d922267a47..6529daee86 100644 --- a/app/components/Layout/Navigation.tsx +++ b/app/components/Layout/Navigation.tsx @@ -39,19 +39,19 @@ const Navigation: React.FC = ({ {userProfileComponent} - ) : router.pathname === "/" ? ( - isLoggedIn ) : ( -
- - {showExternalOperatorsLogin && } -
+ router.pathname !== "/" && ( +
+ + {showExternalOperatorsLogin && } +
+ ) ); const unauthorizedIdir = title === "Access required"; diff --git a/app/components/Session/LoginForm.tsx b/app/components/Session/LoginForm.tsx index 7ac78fcac1..124f0f2e9a 100644 --- a/app/components/Session/LoginForm.tsx +++ b/app/components/Session/LoginForm.tsx @@ -9,33 +9,30 @@ interface Props { const LoginForm: React.FC = ({ isExternal }) => { const router = useRouter(); - let loginURI = isExternal - ? `/login?redirectTo=${getExternalUserLandingPageRoute().pathname}` - : "/login"; + let loginURI = "/login"; if (router.query.redirectTo) loginURI += `?redirectTo=${encodeURIComponent( router.query.redirectTo as string )}`; + else if (isExternal) + loginURI += `?redirectTo=${encodeURIComponent( + getExternalUserLandingPageRoute().pathname as string + )}`; return ( <>
- {isExternal && router.pathname.includes("login-redirect") ? ( - - ) : isExternal ? ( - - ) : router.pathname.includes("login-redirect") ? ( - - ) : ( - - )} +