0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

fix(console): tenant with access token should be redirected (#4056)

This commit is contained in:
Darcy Ye 2023-06-19 16:29:15 +08:00 committed by GitHub
parent 013022d24f
commit b877309f99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,6 +25,7 @@ function Redirect({ tenants, toTenantId }: Props) {
// fetch the full-scoped (with all available tenants) token. // fetch the full-scoped (with all available tenants) token.
if (await trySafe(getAccessToken(indicator))) { if (await trySafe(getAccessToken(indicator))) {
setIsSettle(true); setIsSettle(true);
navigate(toTenantId);
} else { } else {
void signIn(new URL(href, window.location.origin).toString()); void signIn(new URL(href, window.location.origin).toString());
} }
@ -33,7 +34,7 @@ function Redirect({ tenants, toTenantId }: Props) {
if (tenant) { if (tenant) {
void validate(tenant.indicator); void validate(tenant.indicator);
} }
}, [getAccessToken, href, setIsSettle, signIn, tenant]); }, [getAccessToken, href, navigate, setIsSettle, signIn, tenant, toTenantId]);
if (!tenant) { if (!tenant) {
/** Fallback to another available tenant instead of showing `Forbidden`. */ /** Fallback to another available tenant instead of showing `Forbidden`. */