Skip to content

Commit

Permalink
fix(console): should not call cloud API when tenant ID is not valid (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
darcyYe authored Aug 5, 2024
1 parent 2e3a006 commit a731b09
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/console/src/hooks/use-new-subscription-quota.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand All @@ -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', {
Expand Down
2 changes: 1 addition & 1 deletion packages/console/src/hooks/use-new-subscription-usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down

0 comments on commit a731b09

Please sign in to comment.