wenhongquan 3 سال پیش
والد
کامیت
41670d5e63
2فایلهای تغییر یافته به همراه8 افزوده شده و 0 حذف شده
  1. 6 0
      src/store/useIncidentStore.ts
  2. 2 0
      src/utils/request.ts

+ 6 - 0
src/store/useIncidentStore.ts

@@ -66,6 +66,9 @@ export default defineStore<
       try {
         this.toggleLoading();
         this.incidents = await getIncidentList(params);
+        // this.incidents = {};
+      } catch (w) { 
+        this.toggleLoading();
       } finally {
         this.toggleLoading();
       }
@@ -75,6 +78,9 @@ export default defineStore<
         this.toggleLoading();
         const { data } = await getIncidentItem(id);
         this.incidentDetail = data;
+        // this.incidentDetail = {};
+      } catch (w) {
+        this.toggleLoading();
       } finally {
         this.toggleLoading();
       }

+ 2 - 0
src/utils/request.ts

@@ -23,6 +23,7 @@ axios.interceptors.request.use((config) => {
 
 axios.interceptors.response.use(
   (res) => {
+   
     if (res.status >= 200 && res.status < 300) {
       if (res.data?.code === 200) {
         return res.data;
@@ -52,6 +53,7 @@ axios.interceptors.response.use(
           });
         throw Error(res.statusText);
       }
+      
     }
     if (res.status === 401) {
       ElMessage.error({