From f911dede83e941f81c0ab91378b74639596815ee Mon Sep 17 00:00:00 2001
From: Tomas <tomasysh@gmail.com>
Date: 星期三, 15 十二月 2021 13:08:16 +0800
Subject: [PATCH] fixed#132444 - 顧問細節資訊,如 refresh 會出現 property of undefined 的錯

---
 PAMapp/assets/ts/services/httpClient.ts |   32 +++++++++++++++++++-------------
 1 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/PAMapp/assets/ts/services/httpClient.ts b/PAMapp/assets/ts/services/httpClient.ts
index 68a8ba8..531eda2 100644
--- a/PAMapp/assets/ts/services/httpClient.ts
+++ b/PAMapp/assets/ts/services/httpClient.ts
@@ -42,26 +42,32 @@
 }
 
 function loadingStart(): void {
-  window.$nuxt.$loading.start();
+  setTimeout(() => {
+    window.$nuxt.$loading.start();
+  }, 0);
 };
 
 function loadingFinish(): void {
-  window.$nuxt.$loading.finish();
+  setTimeout(() => {
+    window.$nuxt.$loading.finish();
+  }, 0);
 };
 
 function showErrorMessageBox(error: any): void {
   // console.log('error', error, error.response);
-  if (!_.includes(notRequireInterceptorErrorUrl, error.config.url)) {
-    switch (error.response.status) {
-      case 401:
-        Promise.all([ErrorMessageBox('���暹��'), window.$nuxt.$store.dispatch('localStorage/actionStorageClear')]).then(() => {
-          _.isEqual(window.$nuxt.$route.name, 'index') ? location.reload() : window.$nuxt.$router.push('/');
-        });
-        break;
+  setTimeout(() => {
+    if (!_.includes(notRequireInterceptorErrorUrl, error.config.url)) {
+      switch (error.response.status) {
+        case 401:
+          Promise.all([ErrorMessageBox('���暹��'), window.$nuxt.$store.dispatch('localStorage/actionStorageClear')]).then(() => {
+            _.isEqual(window.$nuxt.$route.name, 'index') ? location.reload() : window.$nuxt.$router.push('/');
+          });
+          break;
 
-      default:
-        ErrorMessageBox('', error);
-        break;
+        default:
+          ErrorMessageBox('', error);
+          break;
+      }
     }
-  }
+  }, 0)
 };

--
Gitblit v1.8.0