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

refactor(console): update value of the last-visited tenant wildcard (#6787)

This commit is contained in:
Charles Zhao 2024-11-12 11:20:58 +08:00 committed by GitHub
parent 04992b1565
commit 8e0d717781
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 6 deletions

View file

@ -71,8 +71,9 @@ export default function TenantAccess() {
isAuthenticated &&
currentTenantId &&
// The current tenant is unavailable to the user, maybe a deleted tenant or a tenant that
// the user has no access to. Try with prepended default tenant ID, or if it's not available,
// redirect to the home page.
// the user has no access to.
// If the current tenant ID equals the reserved wildcard "to", replace it with the last
// visited tenant ID and keeping the rest of the URL path, otherwise redirect to home page.
!currentTenant
) {
if (isCloud && defaultTenantId && currentTenantId === reservedTenantIdWildcard) {

View file

@ -35,11 +35,16 @@ const reservedRoutes: Readonly<string[]> = Object.freeze([
]);
/**
* The reserved tenant ID wildcard for the default tenant. Useful when specifying a console URL in
* the documentation or other places where the tenant ID is not known. Will be replaced with the
* actual default tenant ID in the runtime.
* The reserved tenant ID wildcard for the last-visited tenant. Useful when specifying a console URL in
* the documentation or other places where the actual user tenant ID is unknown. The wildcard value "to"
* will be replaced by the detected last-visited tenant ID in the runtime.
*
* @example
* ```md
* [Console > Applications](https://cloud.logto.io/to/applications)
* ```
*/
export const reservedTenantIdWildcard = 'default';
export const reservedTenantIdWildcard = 'to';
/** @see {@link TenantsProvider} for why `useSWR()` is not applicable for this context. */
type Tenants = {