diff --git a/packages/console/src/hooks/use-new-subscription-quota.ts b/packages/console/src/hooks/use-new-subscription-quota.ts index 495905a1e..3a68b3fa4 100644 --- a/packages/console/src/hooks/use-new-subscription-quota.ts +++ b/packages/console/src/hooks/use-new-subscription-quota.ts @@ -5,7 +5,8 @@ import { type NewSubscriptionQuota } from '@/cloud/types/router'; import { isCloud, isDevFeaturesEnabled } from '@/consts/env'; const useNewSubscriptionQuota = (tenantId: string) => { - const cloudApi = useCloudApi(); + // TODO: Console sometimes toast 401 unauthorized error, but can not be reproduced in local environment easily, we temporarily hide the error toast for prod env. + const cloudApi = useCloudApi({ hideErrorToast: !isDevFeaturesEnabled }); return useSWR( isCloud && isDevFeaturesEnabled && tenantId && `/api/tenants/${tenantId}/subscription/quota`, diff --git a/packages/console/src/hooks/use-new-subscription-scopes-usage.ts b/packages/console/src/hooks/use-new-subscription-scopes-usage.ts index 5e39c2005..381ee39ab 100644 --- a/packages/console/src/hooks/use-new-subscription-scopes-usage.ts +++ b/packages/console/src/hooks/use-new-subscription-scopes-usage.ts @@ -5,7 +5,8 @@ import { type NewSubscriptionScopeUsage } from '@/cloud/types/router'; import { isCloud, isDevFeaturesEnabled } from '@/consts/env'; const useNewSubscriptionScopeUsage = (tenantId: string) => { - const cloudApi = useCloudApi(); + // TODO: Console sometimes toast 401 unauthorized error, but can not be reproduced in local environment easily, we temporarily hide the error toast for prod env. + const cloudApi = useCloudApi({ hideErrorToast: !isDevFeaturesEnabled }); const resourceEntityName = 'resources'; const roleEntityName = 'roles'; diff --git a/packages/console/src/hooks/use-new-subscription-usage.ts b/packages/console/src/hooks/use-new-subscription-usage.ts index fe25b5cc7..d64ebccbf 100644 --- a/packages/console/src/hooks/use-new-subscription-usage.ts +++ b/packages/console/src/hooks/use-new-subscription-usage.ts @@ -5,7 +5,8 @@ import { type NewSubscriptionUsage } from '@/cloud/types/router'; import { isCloud, isDevFeaturesEnabled } from '@/consts/env'; const useNewSubscriptionUsage = (tenantId: string) => { - const cloudApi = useCloudApi(); + // TODO: Console sometimes toast 401 unauthorized error, but can not be reproduced in local environment easily, we temporarily hide the error toast for prod env. + const cloudApi = useCloudApi({ hideErrorToast: !isDevFeaturesEnabled }); return useSWR( isCloud && isDevFeaturesEnabled && tenantId && `/api/tenants/${tenantId}/subscription/usage`, diff --git a/packages/console/src/hooks/use-subscription.ts b/packages/console/src/hooks/use-subscription.ts index 89f133b56..d2a7d5817 100644 --- a/packages/console/src/hooks/use-subscription.ts +++ b/packages/console/src/hooks/use-subscription.ts @@ -2,10 +2,11 @@ import useSWR from 'swr'; import { useCloudApi } from '@/cloud/hooks/use-cloud-api'; import { type Subscription } from '@/cloud/types/router'; -import { isCloud } from '@/consts/env'; +import { isCloud, isDevFeaturesEnabled } from '@/consts/env'; const useSubscription = (tenantId: string) => { - const cloudApi = useCloudApi(); + // TODO: Console sometimes toast 401 unauthorized error, but can not be reproduced in local environment easily, we temporarily hide the error toast for prod env. + const cloudApi = useCloudApi({ hideErrorToast: !isDevFeaturesEnabled }); return useSWR( // `tenantId` could be an empty string which may cause the request to fail isCloud && tenantId && `/api/tenants/${tenantId}/subscription`,