修复凭证已过期 刷新页面无法重新登录问题

This commit is contained in:
吕金泽 2021-12-29 16:46:14 +08:00
parent a0590ada4e
commit 360b8a5126
2 changed files with 5 additions and 1 deletions

View File

@ -44,6 +44,11 @@ service.interceptors.response.use(
* You can also judge the status by HTTP Status Code
*/
response => {
if (response.config.url.indexOf('user/info') !== -1 && response.data.code === 402) {
store.dispatch('user/logout').then(() => {
location.reload()
})
}
return new Promise((reslove, reject) => {
const res = response.data
if (res.code !== 200) {

View File

@ -99,7 +99,6 @@ export default {
if (valid) {
this.loading = true
this.$store.dispatch('user/login', this.loginForm).then((res) => {
console.log(res)
this.$router.push({ path: '/dashboard' })
this.loading = false
}).catch(() => {