From e90ca1af6c89b8d00a84b00ea44c4fb96f702e67 Mon Sep 17 00:00:00 2001 From: Mehdi Hamri <143011364+pixelfact@users.noreply.github.com> Date: Fri, 9 Aug 2024 16:20:39 +0200 Subject: [PATCH 1/2] handle auth in appwrapper --- app/page.tsx | 17 ----------------- shared/features/app-wrapper/app-wrapper.tsx | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index 33068b8de..03a9ebc03 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,7 +1,5 @@ "use client"; -import { useAuth0 } from "@auth0/auth0-react"; - import { TestSidePanel } from "@/app/test/_components/side-panel/test-side-panel"; import { AnimatedColumnGroup } from "@/shared/components/animated-column-group/animated-column-group"; @@ -9,21 +7,6 @@ import { AnimatedColumn } from "@/shared/components/animated-column-group/animat import { SecondaryNavigation } from "@/shared/features/navigation/secondary-navigation/secondary-navigation"; export default function Home() { - const { isAuthenticated, isLoading, error, loginWithRedirect } = useAuth0(); - - if (isLoading) { - return
Loading...
; - } - - if (error) { - return
Oops... {error.message}
; - } - - if (!isAuthenticated) { - loginWithRedirect(); - return
Redirecting to login...
; - } - return (
Loading...
; + } + + if (error) { + return
Oops... {error.message}
; + } + + if (!isAuthenticated) { + loginWithRedirect(); + return
Redirecting to login...
; + } + if (isTablet) { return (
From 44039ec1d063ad869e810f9fd69c42dd49cd15de Mon Sep 17 00:00:00 2001 From: Mehdi Hamri <143011364+pixelfact@users.noreply.github.com> Date: Fri, 9 Aug 2024 16:29:38 +0200 Subject: [PATCH 2/2] fix logout --- .../features/navigation/menu/user-menu/user-menu.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/shared/features/navigation/menu/user-menu/user-menu.tsx b/shared/features/navigation/menu/user-menu/user-menu.tsx index 51fe96443..2d14bb185 100644 --- a/shared/features/navigation/menu/user-menu/user-menu.tsx +++ b/shared/features/navigation/menu/user-menu/user-menu.tsx @@ -20,11 +20,13 @@ export function UserMenu({ isFolded }: UserMenuProps) { const { logout } = authProvider ?? {}; function onLogout() { - logout?.({ - logoutParams: { - returnTo: "/", - }, - }); + if (process.env.NEXT_PUBLIC_MARKETPLACE_URL) { + logout?.({ + logoutParams: { + returnTo: process.env.NEXT_PUBLIC_MARKETPLACE_URL, + }, + }); + } } if (isLoading) {