From 6f4b41d84b7968286bd3aa7503afe23375e58fdf Mon Sep 17 00:00:00 2001 From: en Date: Fri, 7 Feb 2025 17:16:45 +0100 Subject: [PATCH] fix(login): remove default login redirect --- src/hooks/useAuth.ts | 5 ++--- src/layouts/Main.tsx | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/hooks/useAuth.ts b/src/hooks/useAuth.ts index e0e75fb..7199a51 100644 --- a/src/hooks/useAuth.ts +++ b/src/hooks/useAuth.ts @@ -56,8 +56,7 @@ export const useAuth = () => { * method will be chosen (extension or keys) * * @param pubkey of the user trying to login - * @returns url to redirect if authentication successfull - * or error if otherwise + * @returns url to redirect if user has no relays set */ const authAndGetMetadataAndRelaysMap = useCallback( async (pubkey: string) => { @@ -108,7 +107,7 @@ export const useAuth = () => { dispatch(setRelayMapAction(relayMap)) } - return appPrivateRoutes.homePage + return }, [ dispatch, diff --git a/src/layouts/Main.tsx b/src/layouts/Main.tsx index c91c986..2106931 100644 --- a/src/layouts/Main.tsx +++ b/src/layouts/Main.tsx @@ -46,7 +46,7 @@ export const MainLayout = () => { const hasSubscribed = useRef(false) const navigateAfterLogin = useCallback( - (path: string) => { + (path: string | undefined) => { const isCallback = window.location.hash.startsWith('#/?callbackPath=') if (isCallback) { const path = atob(window.location.hash.replace('#/?callbackPath=', '')) @@ -57,7 +57,7 @@ export const MainLayout = () => { navigate(path) return } - navigate(path) + if (path) navigate(path) }, [navigate, setSearchParams] )