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:
parent
d38abfb16b
commit
63f2ef0a18
1 changed files with 2 additions and 12 deletions
|
@ -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]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue