mirror of
https://github.com/logto-io/logto.git
synced 2025-01-13 21:30:30 -05:00
fix(console): should stop requesting invitations api for collaborator role (#5650)
This commit is contained in:
parent
79645d7b9d
commit
77db93905d
1 changed files with 3 additions and 1 deletions
|
@ -7,11 +7,13 @@ import { type TenantInvitationResponse, type TenantMemberResponse } from '@/clou
|
||||||
import { SubscriptionDataContext } from '@/contexts/SubscriptionDataProvider';
|
import { SubscriptionDataContext } from '@/contexts/SubscriptionDataProvider';
|
||||||
import { TenantsContext } from '@/contexts/TenantsProvider';
|
import { TenantsContext } from '@/contexts/TenantsProvider';
|
||||||
import { type RequestError } from '@/hooks/use-api';
|
import { type RequestError } from '@/hooks/use-api';
|
||||||
|
import useCurrentTenantScopes from '@/hooks/use-current-tenant-scopes';
|
||||||
import { hasReachedQuotaLimit, hasSurpassedQuotaLimit } from '@/utils/quota';
|
import { hasReachedQuotaLimit, hasSurpassedQuotaLimit } from '@/utils/quota';
|
||||||
|
|
||||||
const useTenantMembersUsage = () => {
|
const useTenantMembersUsage = () => {
|
||||||
const { currentPlan } = useContext(SubscriptionDataContext);
|
const { currentPlan } = useContext(SubscriptionDataContext);
|
||||||
const { currentTenantId } = useContext(TenantsContext);
|
const { currentTenantId } = useContext(TenantsContext);
|
||||||
|
const { canInviteMember } = useCurrentTenantScopes();
|
||||||
|
|
||||||
const cloudApi = useAuthedCloudApi();
|
const cloudApi = useAuthedCloudApi();
|
||||||
|
|
||||||
|
@ -21,7 +23,7 @@ const useTenantMembersUsage = () => {
|
||||||
cloudApi.get('/api/tenants/:tenantId/members', { params: { tenantId: currentTenantId } })
|
cloudApi.get('/api/tenants/:tenantId/members', { params: { tenantId: currentTenantId } })
|
||||||
);
|
);
|
||||||
const { data: invitations } = useSWR<TenantInvitationResponse[], RequestError>(
|
const { data: invitations } = useSWR<TenantInvitationResponse[], RequestError>(
|
||||||
'api/tenants/:tenantId/invitations',
|
canInviteMember && 'api/tenants/:tenantId/invitations',
|
||||||
async () =>
|
async () =>
|
||||||
cloudApi.get('/api/tenants/:tenantId/invitations', { params: { tenantId: currentTenantId } })
|
cloudApi.get('/api/tenants/:tenantId/invitations', { params: { tenantId: currentTenantId } })
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue