value
2023-08-29 b59ad11f54d28a6b4f9b33e5fb30b55e4b263efb
src/utils/request.js
@@ -14,13 +14,14 @@
service.interceptors.request.use(
  config => {
    // do something before request is sent
    if (store.getters.token) {
      // let each request carry token
      // ['X-Token'] is a custom headers key
      // please modify it according to the actual situation
      config.headers['X-Token'] = getToken()
    }
    config.headers['link'] = store.state.settings.link
    // console.log('config' ,config)
    return config
  },
  error => {
@@ -47,7 +48,31 @@
    // if the custom code is not 20000, it is judged as an error.
    if (res.code !== 200) {
      console.log(res.message || 'Error')
      if(res.code===400){
        Message({
        message: res.message,
        type: 'warning',
        duration: 5 * 1000
      })
      }
      if(res.code===401){
        Message({
        message: res.message,
        type: 'warning',
        duration: 5 * 1000
      })
      sessionStorage.removeItem("user")
      sessionStorage.setItem("flushPage",1)
      this.$router.replace({path: '/login'});
      location.reload()
      }
      if(res.code===403){
        Message({
        message: res.message,
        type: 'warning',
        duration: 5 * 1000
      })
      }
      // Message({
      //   message: res.message || 'Error',
      //   type: 'error',