Skip to content

Commit

Permalink
fix(dashboard): new team
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud AMBROSELLI committed Sep 28, 2023
1 parent abcd135 commit b2632cd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion dashboard/src/scenes/team/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion dashboard/src/types/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
};

0 comments on commit b2632cd

Please sign in to comment.