Browse Source

:tada: :tada: :tada: v2.0.0

冷冷 6 years ago
parent
commit
249f0c54c0
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/router/axios.js

+ 4 - 0
src/router/axios.js

@@ -12,6 +12,7 @@ import {getStore} from '../util/store'
 import {getToken} from '@/util/auth'
 import {getToken} from '@/util/auth'
 import NProgress from 'nprogress' // progress bar
 import NProgress from 'nprogress' // progress bar
 import errorCode from '@/const/errorCode'
 import errorCode from '@/const/errorCode'
+import router from "@/router/router"
 import {Message} from 'element-ui'
 import {Message} from 'element-ui'
 import 'nprogress/nprogress.css' // progress bar style
 import 'nprogress/nprogress.css' // progress bar style
 axios.defaults.timeout = 30000
 axios.defaults.timeout = 30000
@@ -57,13 +58,16 @@ axios.interceptors.response.use(res => {
     })
     })
     return Promise.reject(new Error(message))
     return Promise.reject(new Error(message))
   }
   }
+
   if (status === 401) {
   if (status === 401) {
     store.dispatch('FedLogOut').then(() => {
     store.dispatch('FedLogOut').then(() => {
       router.push({
       router.push({
         path: '/login'
         path: '/login'
       })
       })
     })
     })
+    return
   }
   }
+
   if (status !== 200) {
   if (status !== 200) {
     Message({
     Message({
       message: message,
       message: message,