From f36165080601e8710329d59883042158602c57a5 Mon Sep 17 00:00:00 2001 From: Charles Zhao Date: Mon, 8 Apr 2024 16:53:44 +0800 Subject: [PATCH] fix(console): should stop requesting invitations api for collaborator role --- .../console/src/pages/TenantSettings/TenantMembers/hooks.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/console/src/pages/TenantSettings/TenantMembers/hooks.ts b/packages/console/src/pages/TenantSettings/TenantMembers/hooks.ts index 980268115be..b154f551f9b 100644 --- a/packages/console/src/pages/TenantSettings/TenantMembers/hooks.ts +++ b/packages/console/src/pages/TenantSettings/TenantMembers/hooks.ts @@ -7,11 +7,13 @@ import { type TenantInvitationResponse, type TenantMemberResponse } from '@/clou import { SubscriptionDataContext } from '@/contexts/SubscriptionDataProvider'; import { TenantsContext } from '@/contexts/TenantsProvider'; import { type RequestError } from '@/hooks/use-api'; +import useCurrentTenantScopes from '@/hooks/use-current-tenant-scopes'; import { hasReachedQuotaLimit, hasSurpassedQuotaLimit } from '@/utils/quota'; const useTenantMembersUsage = () => { const { currentPlan } = useContext(SubscriptionDataContext); const { currentTenantId } = useContext(TenantsContext); + const { canInviteMember } = useCurrentTenantScopes(); const cloudApi = useAuthedCloudApi(); @@ -21,7 +23,7 @@ const useTenantMembersUsage = () => { cloudApi.get('/api/tenants/:tenantId/members', { params: { tenantId: currentTenantId } }) ); const { data: invitations } = useSWR( - 'api/tenants/:tenantId/invitations', + canInviteMember && 'api/tenants/:tenantId/invitations', async () => cloudApi.get('/api/tenants/:tenantId/invitations', { params: { tenantId: currentTenantId } }) );