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 Breakable from '@/components/Breakable';
|
||||
import { RoleOption } from '@/components/OrganizationRolesSelect';
|
||||
import { SubscriptionDataContext } from '@/contexts/SubscriptionDataProvider';
|
||||
import { TenantsContext } from '@/contexts/TenantsProvider';
|
||||
import ActionMenu, { ActionMenuItem } from '@/ds-components/ActionMenu';
|
||||
import Button from '@/ds-components/Button';
|
||||
|
@ -56,7 +57,7 @@ function Invitations() {
|
|||
const {
|
||||
access: { canInviteMember, canRemoveMember },
|
||||
} = useCurrentTenantScopes();
|
||||
|
||||
const { mutateSubscriptionQuotaAndUsages } = useContext(SubscriptionDataContext);
|
||||
const { data, error, isLoading, mutate } = useSWR<TenantInvitationResponse[], RequestError>(
|
||||
`api/tenants/${currentTenantId}/invitations`,
|
||||
async () =>
|
||||
|
@ -80,6 +81,7 @@ function Invitations() {
|
|||
params: { tenantId: currentTenantId, invitationId },
|
||||
body: { status: OrganizationInvitationStatus.Revoked },
|
||||
});
|
||||
mutateSubscriptionQuotaAndUsages();
|
||||
void mutate();
|
||||
toast.success(t('messages.invitation_revoked'));
|
||||
};
|
||||
|
@ -97,6 +99,7 @@ function Invitations() {
|
|||
await cloudApi.delete(`/api/tenants/:tenantId/invitations/:invitationId`, {
|
||||
params: { tenantId: currentTenantId, invitationId },
|
||||
});
|
||||
mutateSubscriptionQuotaAndUsages();
|
||||
void mutate();
|
||||
toast.success(t('messages.invitation_deleted'));
|
||||
};
|
||||
|
|
|
@ -45,6 +45,7 @@ function InviteMemberModal({ isOpen, onClose }: Props) {
|
|||
currentSubscription: { planId, isAddOnAvailable },
|
||||
currentSubscriptionQuota,
|
||||
currentSubscriptionUsage: { tenantMembersLimit },
|
||||
mutateSubscriptionQuotaAndUsages,
|
||||
} = useContext(SubscriptionDataContext);
|
||||
const {
|
||||
data: { tenantMembersUpsellNoticeAcknowledged },
|
||||
|
@ -109,6 +110,7 @@ function InviteMemberModal({ isOpen, onClose }: Props) {
|
|||
params: { tenantId: currentTenantId },
|
||||
body: { invitee: emails.map(({ value }) => value), roleName: role },
|
||||
});
|
||||
mutateSubscriptionQuotaAndUsages();
|
||||
toast.success(t('tenant_members.messages.invitation_sent'));
|
||||
onClose(true);
|
||||
} finally {
|
||||
|
|
Loading…
Add table
Reference in a new issue