浏览代码

fixed #299

ali 2 年之前
父节点
当前提交
3138e6f64c

+ 4 - 1
src/components/Widgets/Test/TestParticipation/components/AllQuestions.vue

@@ -102,8 +102,11 @@ export default {
               this.$emit('sentfailed')
             })
         })
-        .catch(() => {
+        .catch((error) => {
           this.$emit('sentfailed')
+          if (error.response && error.response.status === 422) {
+            this.$router.push({ name: 'UserPanel.Profile.AllClassrooms' })
+          }
         })
     }
   }

+ 5 - 2
src/components/Widgets/Test/TestParticipation/components/SingleQuestion.vue

@@ -155,8 +155,11 @@ export default {
               })
           }
         })
-        .catch(() => {
-          this.$emit('sentSuccess', actionType)
+        .catch((error) => {
+          this.$emit('sentfailed', actionType)
+          if (error.response && error.response.status === 422) {
+            this.$router.push({ name: 'UserPanel.Profile.AllClassrooms' })
+          }
         })
     },
     goToQuestion (questionNumber) {