mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
fix(console): should not toast invitation sent message when creating tenant w/o invitee (#6270)
fix(console): should not toast invitation sent message when creating tenant without invitee
This commit is contained in:
parent
64b022bdea
commit
4ac4f8cdb4
1 changed files with 15 additions and 13 deletions
|
@ -78,19 +78,21 @@ function CreateTenant() {
|
||||||
tenantId: newTenant.id,
|
tenantId: newTenant.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Should not block the onboarding flow if the invitation fails.
|
if (collaboratorEmails.length > 0) {
|
||||||
try {
|
// Should not block the onboarding flow if the invitation fails.
|
||||||
await Promise.all(
|
try {
|
||||||
collaboratorEmails.map(async (email) =>
|
await Promise.all(
|
||||||
tenantCloudApi.post('/api/tenants/:tenantId/invitations', {
|
collaboratorEmails.map(async (email) =>
|
||||||
params: { tenantId: newTenant.id },
|
tenantCloudApi.post('/api/tenants/:tenantId/invitations', {
|
||||||
body: { invitee: email.value, roleName: TenantRole.Collaborator },
|
params: { tenantId: newTenant.id },
|
||||||
})
|
body: { invitee: email.value, roleName: TenantRole.Collaborator },
|
||||||
)
|
})
|
||||||
);
|
)
|
||||||
toast.success(t('tenant_members.messages.invitation_sent'));
|
);
|
||||||
} catch {
|
toast.success(t('tenant_members.messages.invitation_sent'));
|
||||||
toast.error(t('tenants.create_modal.invitation_failed', { duration: 5 }));
|
} catch {
|
||||||
|
toast.error(t('tenants.create_modal.invitation_failed', { duration: 5 }));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
navigate(joinPath(OnboardingRoute.Onboarding, newTenant.id, OnboardingPage.SignInExperience));
|
navigate(joinPath(OnboardingRoute.Onboarding, newTenant.id, OnboardingPage.SignInExperience));
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue