From 1a4720f31839642ec33009e64a0ac4850987d5c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Truite=20S=C3=A9ch=C3=A9e?= Date: Wed, 16 Oct 2024 18:27:35 +0200 Subject: [PATCH] fix: now detects teacher accounts and reports to the user that it's not supported yet --- src/App.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 4b0e537..d62fc13 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -71,7 +71,7 @@ function consoleLogEDPLogo() { consoleLogEDPLogo(); const currentEDPVersion = "0.4.0"; -const apiVersion = "4.60.5"; +const apiVersion = "4.64.0"; // secret webhooks const carpeConviviale = "CARPE_CONVIVIALE_WEBHOOK_URL"; @@ -1355,7 +1355,12 @@ export default function App({ edpFetch }) { } let token = response.token // collecte du token let accountsList = []; - let accounts = response.data.accounts[0]; + let accounts = response.data.accounts.find((account) => account.typeCompte !== "P") ?? response.data.accounts[0]; + if (response.data.accounts.some((account) => account.typeCompte === "P")) { + messages.submitButtonText = "Échec de la connexion"; + messages.submitErrorMessage = "Les comptes enseignants ne sont pas supportés par Ecole Directe Plus"; + return; + } const accountType = accounts.typeCompte; // collecte du type de compte if (accountType === "E") { // compte élève