🐞 fix: 优化singleSign方法;确保无论成功与否都能重定向到主页

This commit is contained in:
LokerL 2024-11-27 13:50:12 +08:00
parent a2ceabb9e9
commit 43e291dd52
1 changed files with 2 additions and 4 deletions

View File

@ -16,10 +16,8 @@ export default {
methods: {
singleSign() {
const { userName, password = "123456" } = this.$route.query;
this.$store.dispatch("SingleSign", { userName, password }).then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
}).catch((error) => {
console.error(error);
this.$store.dispatch("SingleSign", { userName, password }).finally(() => {
this.$router.push({ path: "/" }).catch(()=>{});
});
},
}