退出登录/token过期-清除本地储存
This commit is contained in:
		
							parent
							
								
									c8f93c6d8b
								
							
						
					
					
						commit
						d14a5b4335
					
				| 
						 | 
				
			
			@ -101,6 +101,8 @@ export default {
 | 
			
		|||
        console.log('🚀 ~ process.env.VUE_APP_BASE_API:', process.env.VUE_APP_BASE_API)
 | 
			
		||||
        if (process.env.VUE_APP_BASE_API == '/iws/jiju-api') {
 | 
			
		||||
          setTimeout(() => {
 | 
			
		||||
            localStorage.clear()
 | 
			
		||||
            sessionStorage.clear()
 | 
			
		||||
            window.location.replace(
 | 
			
		||||
              'http://sgwpdm.ah.sgcc.com.cn/iws/',
 | 
			
		||||
            )
 | 
			
		||||
| 
						 | 
				
			
			@ -108,6 +110,8 @@ export default {
 | 
			
		|||
        } else {
 | 
			
		||||
          this.$store.dispatch('LogOut').then(() => {
 | 
			
		||||
            location.href = '/login'
 | 
			
		||||
            localStorage.clear()
 | 
			
		||||
            sessionStorage.clear()
 | 
			
		||||
          })
 | 
			
		||||
        }
 | 
			
		||||
      }).catch(() => {});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -130,6 +130,8 @@ service.interceptors.response.use(res => {
 | 
			
		|||
          router.push('/login')
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
      localStorage.clear()
 | 
			
		||||
      sessionStorage.clear()
 | 
			
		||||
      return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
 | 
			
		||||
    } else if (code === 500) {
 | 
			
		||||
      Message({ message: msg, type: 'error' })
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue