Skip to content

Commit

Permalink
fix(console): should stop requesting invitations api for collaborator…
Browse files Browse the repository at this point in the history
… role (#5650)
  • Loading branch information
charIeszhao committed Apr 8, 2024
1 parent 79645d7 commit 77db939
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -21,7 +23,7 @@ const useTenantMembersUsage = () => {
cloudApi.get('/api/tenants/:tenantId/members', { params: { tenantId: currentTenantId } })
);
const { data: invitations } = useSWR<TenantInvitationResponse[], RequestError>(
'api/tenants/:tenantId/invitations',
canInviteMember && 'api/tenants/:tenantId/invitations',
async () =>
cloudApi.get('/api/tenants/:tenantId/invitations', { params: { tenantId: currentTenantId } })
);
Expand Down

0 comments on commit 77db939

Please sign in to comment.