From 4f018c515620ef87a22424344070532e02e4eefe Mon Sep 17 00:00:00 2001 From: Arnaud Ambroselli <31724752+arnaudambro@users.noreply.github.com> Date: Fri, 29 Sep 2023 07:48:50 +0200 Subject: [PATCH] fix(dashboard): new team (#1683) --- dashboard/src/scenes/team/list.js | 7 ++++++- dashboard/src/types/user.ts | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dashboard/src/scenes/team/list.js b/dashboard/src/scenes/team/list.js index 130c4ee79..d70e31196 100644 --- a/dashboard/src/scenes/team/list.js +++ b/dashboard/src/scenes/team/list.js @@ -125,7 +125,12 @@ const Create = () => { body: { name: values.name, organisation: organisation._id, nightSession: values.nightSession === 'true' }, }); if (!newTeamRes.ok) return actions.setSubmitting(false); - const userPutRes = await API.put({ path: `/user/${user._id}`, body: { team: [...(user.team || []), newTeamRes.data._id] } }); + const userPutRes = await API.put({ + path: `/user/${user._id}`, + body: { + team: [...(user.teams || []).map((team) => team._id), newTeamRes.data._id], + }, + }); if (!userPutRes.ok) return actions.setSubmitting(false); const meResponse = await API.get({ path: '/user/me' }); setUser(meResponse.user); diff --git a/dashboard/src/types/user.ts b/dashboard/src/types/user.ts index a7435d0ed..8014df9a3 100644 --- a/dashboard/src/types/user.ts +++ b/dashboard/src/types/user.ts @@ -10,5 +10,6 @@ export type UserInstance = { termsAccepted: Date | null; healthcareProfessional: boolean | null; role: 'normal' | 'admin'; // Add other roles if available. - team: UUIDV4[]; + team?: UUIDV4[]; + teams?: UUIDV4[]; };