From b877309f996bbbca0602efa550f4fe2763bafd61 Mon Sep 17 00:00:00 2001 From: Darcy Ye Date: Mon, 19 Jun 2023 16:29:15 +0800 Subject: [PATCH] fix(console): tenant with access token should be redirected (#4056) --- packages/console/src/cloud/pages/Main/Redirect.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/console/src/cloud/pages/Main/Redirect.tsx b/packages/console/src/cloud/pages/Main/Redirect.tsx index 7b222ec90..a0152a55f 100644 --- a/packages/console/src/cloud/pages/Main/Redirect.tsx +++ b/packages/console/src/cloud/pages/Main/Redirect.tsx @@ -25,6 +25,7 @@ function Redirect({ tenants, toTenantId }: Props) { // fetch the full-scoped (with all available tenants) token. if (await trySafe(getAccessToken(indicator))) { setIsSettle(true); + navigate(toTenantId); } else { void signIn(new URL(href, window.location.origin).toString()); } @@ -33,7 +34,7 @@ function Redirect({ tenants, toTenantId }: Props) { if (tenant) { void validate(tenant.indicator); } - }, [getAccessToken, href, setIsSettle, signIn, tenant]); + }, [getAccessToken, href, navigate, setIsSettle, signIn, tenant, toTenantId]); if (!tenant) { /** Fallback to another available tenant instead of showing `Forbidden`. */