| | |
| | | import { AxiosRequestConfig, AxiosError, AxiosResponse } from 'axios'; |
| | | import ErrorMessageBox from '../errorService'; |
| | | import LocalStorage from '~/store/localStorage'; |
| | | import axios from 'axios'; |
| | | import _ from 'lodash'; |
| | | |
| | |
| | | }; |
| | | |
| | | function showErrorMessageBox(error:any):void{ |
| | | // console.log('error', error, error.response); |
| | | if(!_.includes(notRequireInterceptorErrorUrl,error.config.url)){ |
| | | switch (error.response.status) { |
| | | case 401: |
| | | ErrorMessageBox('登入逾時'); |
| | | window.$nuxt.$router.push('/'); |
| | | window.$nuxt.$store.commit('localStorage/storageClear'); |
| | | Promise.all([ErrorMessageBox('登入逾時'),window.$nuxt.$store.dispatch('localStorage/actionStorageClear')]).then(()=>{ |
| | | location.href='/'; |
| | | }); |
| | | break; |
| | | |
| | | default: |
| | | ErrorMessageBox(); |
| | | ErrorMessageBox('', error); |
| | | break; |
| | | } |
| | | |
| | | } |
| | | }; |