mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
refactor: Use POST /users to re-invite users (no-changelog) (#7714)
This commit is contained in:
@@ -8,7 +8,6 @@ import {
|
||||
login,
|
||||
loginCurrentUser,
|
||||
logout,
|
||||
reinvite,
|
||||
sendForgotPasswordEmail,
|
||||
setupOwner,
|
||||
signup,
|
||||
@@ -328,9 +327,14 @@ export const useUsersStore = defineStore(STORES.USERS, {
|
||||
this.addUsers(users.map(({ user }) => ({ isPending: true, ...user })));
|
||||
return users;
|
||||
},
|
||||
async reinviteUser(params: { id: string }): Promise<void> {
|
||||
async reinviteUser(params: { email: string }): Promise<void> {
|
||||
const rootStore = useRootStore();
|
||||
await reinvite(rootStore.getRestApiContext, params);
|
||||
const invitationResponse = await inviteUsers(rootStore.getRestApiContext, [
|
||||
{ email: params.email },
|
||||
]);
|
||||
if (!invitationResponse[0].user.emailSent) {
|
||||
throw Error(invitationResponse[0].error);
|
||||
}
|
||||
},
|
||||
async getUserInviteLink(params: { id: string }): Promise<{ link: string }> {
|
||||
const rootStore = useRootStore();
|
||||
|
||||
@@ -144,15 +144,14 @@ export default defineComponent({
|
||||
},
|
||||
async onReinvite(userId: string) {
|
||||
const user = this.usersStore.getUserById(userId);
|
||||
if (user) {
|
||||
if (user?.email) {
|
||||
try {
|
||||
await this.usersStore.reinviteUser({ id: user.id });
|
||||
|
||||
await this.usersStore.reinviteUser({ email: user.email });
|
||||
this.showToast({
|
||||
type: 'success',
|
||||
title: this.$locale.baseText('settings.users.inviteResent'),
|
||||
message: this.$locale.baseText('settings.users.emailSentTo', {
|
||||
interpolate: { email: user.email || '' },
|
||||
interpolate: { email: user.email ?? '' },
|
||||
}),
|
||||
});
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user