mirror of
https://github.com/logto-io/logto.git
synced 2025-02-17 22:04:19 -05:00
fix(console): manually trigger usage api updates (#6473)
This commit is contained in:
parent
e0623df01f
commit
608d2efdb5
2 changed files with 6 additions and 1 deletions
|
@ -17,6 +17,7 @@ import { useAuthedCloudApi } from '@/cloud/hooks/use-cloud-api';
|
||||||
import type { InvitationResponse, TenantInvitationResponse } from '@/cloud/types/router';
|
import type { InvitationResponse, TenantInvitationResponse } from '@/cloud/types/router';
|
||||||
import Breakable from '@/components/Breakable';
|
import Breakable from '@/components/Breakable';
|
||||||
import { RoleOption } from '@/components/OrganizationRolesSelect';
|
import { RoleOption } from '@/components/OrganizationRolesSelect';
|
||||||
|
import { SubscriptionDataContext } from '@/contexts/SubscriptionDataProvider';
|
||||||
import { TenantsContext } from '@/contexts/TenantsProvider';
|
import { TenantsContext } from '@/contexts/TenantsProvider';
|
||||||
import ActionMenu, { ActionMenuItem } from '@/ds-components/ActionMenu';
|
import ActionMenu, { ActionMenuItem } from '@/ds-components/ActionMenu';
|
||||||
import Button from '@/ds-components/Button';
|
import Button from '@/ds-components/Button';
|
||||||
|
@ -56,7 +57,7 @@ function Invitations() {
|
||||||
const {
|
const {
|
||||||
access: { canInviteMember, canRemoveMember },
|
access: { canInviteMember, canRemoveMember },
|
||||||
} = useCurrentTenantScopes();
|
} = useCurrentTenantScopes();
|
||||||
|
const { mutateSubscriptionQuotaAndUsages } = useContext(SubscriptionDataContext);
|
||||||
const { data, error, isLoading, mutate } = useSWR<TenantInvitationResponse[], RequestError>(
|
const { data, error, isLoading, mutate } = useSWR<TenantInvitationResponse[], RequestError>(
|
||||||
`api/tenants/${currentTenantId}/invitations`,
|
`api/tenants/${currentTenantId}/invitations`,
|
||||||
async () =>
|
async () =>
|
||||||
|
@ -80,6 +81,7 @@ function Invitations() {
|
||||||
params: { tenantId: currentTenantId, invitationId },
|
params: { tenantId: currentTenantId, invitationId },
|
||||||
body: { status: OrganizationInvitationStatus.Revoked },
|
body: { status: OrganizationInvitationStatus.Revoked },
|
||||||
});
|
});
|
||||||
|
mutateSubscriptionQuotaAndUsages();
|
||||||
void mutate();
|
void mutate();
|
||||||
toast.success(t('messages.invitation_revoked'));
|
toast.success(t('messages.invitation_revoked'));
|
||||||
};
|
};
|
||||||
|
@ -97,6 +99,7 @@ function Invitations() {
|
||||||
await cloudApi.delete(`/api/tenants/:tenantId/invitations/:invitationId`, {
|
await cloudApi.delete(`/api/tenants/:tenantId/invitations/:invitationId`, {
|
||||||
params: { tenantId: currentTenantId, invitationId },
|
params: { tenantId: currentTenantId, invitationId },
|
||||||
});
|
});
|
||||||
|
mutateSubscriptionQuotaAndUsages();
|
||||||
void mutate();
|
void mutate();
|
||||||
toast.success(t('messages.invitation_deleted'));
|
toast.success(t('messages.invitation_deleted'));
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,6 +45,7 @@ function InviteMemberModal({ isOpen, onClose }: Props) {
|
||||||
currentSubscription: { planId, isAddOnAvailable },
|
currentSubscription: { planId, isAddOnAvailable },
|
||||||
currentSubscriptionQuota,
|
currentSubscriptionQuota,
|
||||||
currentSubscriptionUsage: { tenantMembersLimit },
|
currentSubscriptionUsage: { tenantMembersLimit },
|
||||||
|
mutateSubscriptionQuotaAndUsages,
|
||||||
} = useContext(SubscriptionDataContext);
|
} = useContext(SubscriptionDataContext);
|
||||||
const {
|
const {
|
||||||
data: { tenantMembersUpsellNoticeAcknowledged },
|
data: { tenantMembersUpsellNoticeAcknowledged },
|
||||||
|
@ -109,6 +110,7 @@ function InviteMemberModal({ isOpen, onClose }: Props) {
|
||||||
params: { tenantId: currentTenantId },
|
params: { tenantId: currentTenantId },
|
||||||
body: { invitee: emails.map(({ value }) => value), roleName: role },
|
body: { invitee: emails.map(({ value }) => value), roleName: role },
|
||||||
});
|
});
|
||||||
|
mutateSubscriptionQuotaAndUsages();
|
||||||
toast.success(t('tenant_members.messages.invitation_sent'));
|
toast.success(t('tenant_members.messages.invitation_sent'));
|
||||||
onClose(true);
|
onClose(true);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
Loading…
Add table
Reference in a new issue