| | |
| | | } |
| | | |
| | | 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) |
| | | }; |