Fix cloud authorization when token was expired/invalid (#4032)

* Fix cloud auth if token was expired

* Fix cloud auth if token was expired
This commit is contained in:
Patryk Andrzejewski 2023-07-31 11:39:44 +02:00 committed by GitHub
parent d38abfb16b
commit 63f2ef0a18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,4 @@
// @ts-strict-ignore // @ts-strict-ignore
import { getAppMountUri } from "@dashboard/config";
import { getAppMountUriForRedirect } from "@dashboard/utils/urls"; import { getAppMountUriForRedirect } from "@dashboard/utils/urls";
import { useEffect } from "react"; import { useEffect } from "react";
import urlJoin from "url-join"; import urlJoin from "url-join";
@ -40,17 +39,8 @@ export const useAuthRedirection = () => {
}; };
useEffect(() => { useEffect(() => {
if (!shouldRedirect) { if (shouldRedirect && !authenticated && !authenticating) {
return; handleAuthentication()
}
if (authenticated || authenticating) {
window.location.href = getAppMountUri();
return;
}
if (!authenticated && !authenticating) {
handleAuthentication();
} }
}, [shouldRedirect, authenticated, authenticating]); }, [shouldRedirect, authenticated, authenticating]);