diff --git a/magic-boot-ui/src/scripts/request.js b/magic-boot-ui/src/scripts/request.js index 6fedf1d..eb88235 100644 --- a/magic-boot-ui/src/scripts/request.js +++ b/magic-boot-ui/src/scripts/request.js @@ -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) { diff --git a/magic-boot-ui/src/views/login/index.vue b/magic-boot-ui/src/views/login/index.vue index c69d9fb..5ff8e18 100644 --- a/magic-boot-ui/src/views/login/index.vue +++ b/magic-boot-ui/src/views/login/index.vue @@ -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(() => {