| | |
| | | import { AxiosRequestConfig, AxiosError, AxiosResponse} from 'axios'; |
| | | import axios from 'axios'; |
| | | import _ from 'lodash'; |
| | | import axios, { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios'; |
| | | |
| | | import messageBoxService from './message-box.service'; |
| | | |
| | |
| | | messageBoxService.showErrorMessage('', error); |
| | | return |
| | | } |
| | | if (!_.includes(notRequireInterceptorErrorUrl, error.config.url)) { |
| | | if (!notRequireInterceptorErrorUrl.includes(error.config.url)) { |
| | | switch (error.response.status) { |
| | | case 401: |
| | | Promise.all([messageBoxService.showErrorMessage('登入逾時'), window.$nuxt.$store.dispatch('localStorage/actionStorageClear')]).then(() => { |
| | | _.isEqual(window.$nuxt.$route.name, 'index') ? location.reload() : window.$nuxt.$router.push('/'); |
| | | if (window.$nuxt.$route.name === 'index') { |
| | | location.reload(); |
| | | } else { |
| | | window.$nuxt.$router.push('/'); |
| | | } |
| | | }); |
| | | break; |
| | | |