From 0770da3b184b5d5e71fee8251a5847a04c7cb9bc Mon Sep 17 00:00:00 2001 From: Romaric Mourgues Date: Wed, 5 Apr 2023 20:11:30 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20Patch=204=20-=20Fix=20guest=20in?= =?UTF-8?q?vitation=20with=20new=20console=20documentation=20(#2791)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/services/console/clients/remote.ts | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/twake/backend/node/src/services/console/clients/remote.ts b/twake/backend/node/src/services/console/clients/remote.ts index 14e8ab06da..ec0ffbf73e 100644 --- a/twake/backend/node/src/services/console/clients/remote.ts +++ b/twake/backend/node/src/services/console/clients/remote.ts @@ -57,15 +57,28 @@ export class ConsoleRemoteClient implements ConsoleServiceClient { if (user.skipInvite && user.name && user.email && user.password) { return this.client - .post(`/api/companies/${company.code}/users`, user, { - auth: this.auth(), - headers: { - "Content-Type": "application/json", + .post( + `/api/companies/${company.code}/users`, + { + ...user, + ...(isNewConsole + ? { + name: user.lastName ? user.firstName : user.name, + surname: user.lastName, + applicationCodes: ["twake"], + } + : {}), }, - params: { - skipInvite: user.skipInvite, + { + auth: this.auth(), + headers: { + "Content-Type": "application/json", + }, + params: { + skipInvite: user.skipInvite, + }, }, - }) + ) .then(({ data }) => data); } else { const invitationData = {