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

fix(console): should not call cloud API when tenant ID is not valid (#6399)

This commit is contained in:
Darcy Ye 2024-08-05 13:18:18 +08:00 committed by GitHub
parent 2e3a0063ba
commit a731b09122
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 2 deletions

View file

@ -8,7 +8,7 @@ const useNewSubscriptionQuota = (tenantId: string) => {
const cloudApi = useCloudApi();
return useSWR<NewSubscriptionQuota, Error>(
isCloud && isDevFeaturesEnabled && `/api/tenants/${tenantId}/subscription/quota`,
isCloud && isDevFeaturesEnabled && tenantId && `/api/tenants/${tenantId}/subscription/quota`,
async () =>
cloudApi.get('/api/tenants/:tenantId/subscription/quota', {
params: { tenantId },

View file

@ -14,6 +14,7 @@ const useNewSubscriptionScopeUsage = (tenantId: string) => {
scopeResourceUsage: useSWR<NewSubscriptionScopeUsage, Error>(
isCloud &&
isDevFeaturesEnabled &&
tenantId &&
`/api/tenants/${tenantId}/subscription/usage/${resourceEntityName}/scopes`,
async () =>
cloudApi.get('/api/tenants/:tenantId/subscription/usage/:entityName/scopes', {
@ -24,6 +25,7 @@ const useNewSubscriptionScopeUsage = (tenantId: string) => {
scopeRoleUsage: useSWR<NewSubscriptionScopeUsage, Error>(
isCloud &&
isDevFeaturesEnabled &&
tenantId &&
`/api/tenants/${tenantId}/subscription/usage/${roleEntityName}/scopes`,
async () =>
cloudApi.get('/api/tenants/:tenantId/subscription/usage/:entityName/scopes', {

View file

@ -8,7 +8,7 @@ const useNewSubscriptionUsage = (tenantId: string) => {
const cloudApi = useCloudApi();
return useSWR<NewSubscriptionUsage, Error>(
isCloud && isDevFeaturesEnabled && `/api/tenants/${tenantId}/subscription/usage`,
isCloud && isDevFeaturesEnabled && tenantId && `/api/tenants/${tenantId}/subscription/usage`,
async () =>
cloudApi.get('/api/tenants/:tenantId/subscription/usage', {
params: { tenantId },