From 63f2ef0a18f6e1d36747db943fb246585a12d3e9 Mon Sep 17 00:00:00 2001 From: Patryk Andrzejewski Date: Mon, 31 Jul 2023 11:39:44 +0200 Subject: [PATCH] Fix cloud authorization when token was expired/invalid (#4032) * Fix cloud auth if token was expired * Fix cloud auth if token was expired --- src/auth/hooks/useAuthRedirection.ts | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/auth/hooks/useAuthRedirection.ts b/src/auth/hooks/useAuthRedirection.ts index 6ffbb6e59..a00c49139 100644 --- a/src/auth/hooks/useAuthRedirection.ts +++ b/src/auth/hooks/useAuthRedirection.ts @@ -1,5 +1,4 @@ // @ts-strict-ignore -import { getAppMountUri } from "@dashboard/config"; import { getAppMountUriForRedirect } from "@dashboard/utils/urls"; import { useEffect } from "react"; import urlJoin from "url-join"; @@ -40,17 +39,8 @@ export const useAuthRedirection = () => { }; useEffect(() => { - if (!shouldRedirect) { - return; - } - - if (authenticated || authenticating) { - window.location.href = getAppMountUri(); - return; - } - - if (!authenticated && !authenticating) { - handleAuthentication(); + if (shouldRedirect && !authenticated && !authenticating) { + handleAuthentication() } }, [shouldRedirect, authenticated, authenticating]);