From 4f33da2a3f47a594ead52cc0467249977a92c772 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期二, 15 十二月 2020 10:04:09 +0800
Subject: [PATCH] 登录后push添加catch防止出现检查错误
---
ruoyi-ui/src/permission.js | 14 ++------------
ruoyi-ui/src/views/login.vue | 15 ++++++---------
2 files changed, 8 insertions(+), 21 deletions(-)
diff --git a/ruoyi-ui/src/permission.js b/ruoyi-ui/src/permission.js
index 17e5b3d..2c0b1cf 100644
--- a/ruoyi-ui/src/permission.js
+++ b/ruoyi-ui/src/permission.js
@@ -23,28 +23,18 @@
// 鎷夊彇user_info
const roles = res.roles
store.dispatch('GenerateRoutes', { roles }).then(accessRoutes => {
- // 娴嬭瘯 榛樿闈欐�侀〉闈�
- // store.dispatch('permission/generateRoutes', { roles }).then(accessRoutes => {
// 鏍规嵁roles鏉冮檺鐢熸垚鍙闂殑璺敱琛�
router.addRoutes(accessRoutes) // 鍔ㄦ�佹坊鍔犲彲璁块棶璺敱琛�
next({ ...to, replace: true }) // hack鏂规硶 纭繚addRoutes宸插畬鎴�
})
- })
- .catch(err => {
- store.dispatch('FedLogOut').then(() => {
+ }).catch(err => {
+ store.dispatch('LogOut').then(() => {
Message.error(err)
next({ path: '/' })
})
})
} else {
next()
- // 娌℃湁鍔ㄦ�佹敼鍙樻潈闄愮殑闇�姹傚彲鐩存帴next() 鍒犻櫎涓嬫柟鏉冮檺鍒ゆ柇 鈫�
- // if (hasPermission(store.getters.roles, to.meta.roles)) {
- // next()
- // } else {
- // next({ path: '/401', replace: true, query: { noGoBack: true }})
- // }
- // 鍙垹 鈫�
}
}
} else {
diff --git a/ruoyi-ui/src/views/login.vue b/ruoyi-ui/src/views/login.vue
index 574ca0b..6b2139e 100644
--- a/ruoyi-ui/src/views/login.vue
+++ b/ruoyi-ui/src/views/login.vue
@@ -126,15 +126,12 @@
Cookies.remove("password");
Cookies.remove('rememberMe');
}
- this.$store
- .dispatch("Login", this.loginForm)
- .then(() => {
- this.$router.push({ path: this.redirect || "/" });
- })
- .catch(() => {
- this.loading = false;
- this.getCode();
- });
+ this.$store.dispatch("Login", this.loginForm).then(() => {
+ this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
+ }).catch(() => {
+ this.loading = false;
+ this.getCode();
+ });
}
});
}
--
Gitblit v1.9.3