0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-30 20:33:54 -05:00

fix(console): should stop requesting invitations api for collaborator role (#5650)

This commit is contained in:
Charles Zhao 2024-04-08 17:11:25 +08:00 committed by GitHub
parent 79645d7b9d
commit 77db93905d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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<TenantInvitationResponse[], RequestError>(
'api/tenants/:tenantId/invitations',
canInviteMember && 'api/tenants/:tenantId/invitations',
async () =>
cloudApi.get('/api/tenants/:tenantId/invitations', { params: { tenantId: currentTenantId } })
);