From 26c95d17455433137b129d29d1331f358336f223 Mon Sep 17 00:00:00 2001 From: AlexandreS <32449369+AlexandreSi@users.noreply.github.com> Date: Mon, 25 Nov 2024 11:47:33 +0100 Subject: [PATCH] Show error box to user when an error occurred creating students (#7187) --- newIDE/app/src/Profile/Team/TeamProvider.js | 22 ++++++++------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/newIDE/app/src/Profile/Team/TeamProvider.js b/newIDE/app/src/Profile/Team/TeamProvider.js index 6607e67067e1..6a0349cd976f 100644 --- a/newIDE/app/src/Profile/Team/TeamProvider.js +++ b/newIDE/app/src/Profile/Team/TeamProvider.js @@ -23,6 +23,7 @@ import { } from '../../Utils/GDevelopServices/User'; import AuthenticatedUserContext from '../../Profile/AuthenticatedUserContext'; import { listOtherUserCloudProjects } from '../../Utils/GDevelopServices/Project'; +import { showErrorBox } from '../../UI/Messages/MessageBox'; type Props = {| children: React.Node |}; @@ -122,26 +123,19 @@ const TeamProvider = ({ children }: Props) => { async quantity => { if (!team || !adminUserId) return; try { - const createdUsers = await createTeamMembers(getAuthorizationHeader, { + await createTeamMembers(getAuthorizationHeader, { teamId: team.id, quantity, adminUserId, }); - try { - await activateTeamMembers(getAuthorizationHeader, { - teamId: team.id, - activate: true, - userIds: createdUsers.map(user => user.uid), - adminUserId, - }); - } catch (error) { - console.error( - 'An error occurred while activating newly created members', - error - ); - } } catch (error) { console.error('An error occurred while creating team members:', error); + showErrorBox({ + rawError: error, + message: + 'There was an error while creating students in your plan. You can report it at education@gdevelop.io or try again later.', + errorId: 'student-creation-error', + }); } }, [team, getAuthorizationHeader, adminUserId]