From 360b8a5126a793300c6c8da1936189ac0b4c9908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=95=E9=87=91=E6=B3=BD?= <1098696801@qq.com> Date: Wed, 29 Dec 2021 16:46:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=87=AD=E8=AF=81=E5=B7=B2?= =?UTF-8?q?=E8=BF=87=E6=9C=9F=20=E5=88=B7=E6=96=B0=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E9=87=8D=E6=96=B0=E7=99=BB=E5=BD=95=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- magic-boot-ui/src/scripts/request.js | 5 +++++ magic-boot-ui/src/views/login/index.vue | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) 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(() => {