Browse Source

Add More feedback on failing quetionnaire

tripeur 4 years ago
parent
commit
691d5b4bd4
1 changed files with 15 additions and 1 deletions
  1. 15 1
      src/components/Questionaire.vue

+ 15 - 1
src/components/Questionaire.vue

@@ -157,6 +157,7 @@ export default defineComponent({
     saveBenevole() {
       this.checkDone = true;
       if (!this.areQuestionValid) {
+        Toast({ html: "Veuillez répondre à toutes les questions soulignées", classes: "error" });
         return;
       }
       if (this.name == "") {
@@ -186,6 +187,18 @@ export default defineComponent({
         .filter((q) => q.type == "text")
         .map((q) => q.title + " : " + (this.commentObject[q.uuid] ?? ""))
         .join("\n\r");
+      if (this.comment.length > 500) {
+        Toast({
+          html:
+            "Les réponses textuels sont trop longues<br>" +
+            this.comment.length +
+            "/500 charactères",
+
+          classes: "error",
+        });
+
+        return;
+      }
       const benevole: BenevoleJSON = {
         name: this.name,
         surname: this.surname,
@@ -218,7 +231,8 @@ export default defineComponent({
         })
         .then((data: BenevoleJSON) => {
           this.$emit("newRegistration", Benevole.fromJSON(data));
-        });
+        })
+        .catch((error) => Toast({ html: "Erreur" + error, classes: "error" }));
     },
   },
 });