From eb88cc77130d673b8a8ca1ece9f528dc14ead5ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Chambon?= Date: Mon, 16 Oct 2023 16:07:51 +0200 Subject: [PATCH] fix error handling in reportErrorView --- components/theses/ReportErrorView.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/theses/ReportErrorView.vue b/components/theses/ReportErrorView.vue index 4915ecae..cb2f1e07 100644 --- a/components/theses/ReportErrorView.vue +++ b/components/theses/ReportErrorView.vue @@ -135,8 +135,11 @@ function validate() { grecaptcha.ready(function () { loading.value = true; grecaptcha.execute('6LchRDMnAAAAAFSPyM8p7mvowBkOiQC6WYahnsV-', { action: 'submit' }).then(function (token) { - postSignalerErreur(buildJSONToPost(token)).then(() => { - emit('done'); + postSignalerErreur(buildJSONToPost(token)).then((res) => { + const error = res.error.value; + if (error) { + errMsg.value = "Erreur : " + error.data.message; + } }).catch((err) => { errMsg.value = "Erreur : " + err.response.data.message; }).finally(() => { loading.value = false; });