Browse Source

登录错误信息处理

yuanmingze 3 tháng trước cách đây
mục cha
commit
5d73551b4b
1 tập tin đã thay đổi với 11 bổ sung4 xóa
  1. 11 4
      src/views/login/index.vue

+ 11 - 4
src/views/login/index.vue

@@ -146,10 +146,17 @@ const login = async () => {
     return
   }
 
-  const res: any = await loginEtssmsApi(formData)
-  if (res?.access_token) {
-    userStore.setAccessToken(res.access_token)
-    router.replace({ path: '/invoice-information' })
+  try {
+    const res: any = await loginEtssmsApi(formData)
+    if (res?.access_token) {
+      userStore.setAccessToken(res.access_token)
+      router.replace({ path: '/invoice-information' })
+    }
+  } catch (err: any) {
+    const { code, message } = err
+    if (code && message) {
+      showFailToast(message)
+    }
   }
 }