到第三方登录页面时先删除之前的token

This commit is contained in:
dongq107 2023-05-18 15:12:31 +08:00
parent d09e415720
commit ce62a19aa0
2 changed files with 6 additions and 4 deletions

View File

@ -3,7 +3,7 @@ import store from '@/store/index';
import router from './router/index';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
import { setToken, getToken, getSessionStorage, setSessionStorage } from '@/utils/auth';
import { setToken, getToken, getSessionStorage, setSessionStorage, removeToken } from '@/utils/auth';
import { getFrontProjectConfigByLogin} from '@/api/projectConfig';
import localStore from 'storejs';
import { handlerUrl } from '@/utils/baseUrl';
@ -83,7 +83,10 @@ function handleRoute(to, next, loginPath) {
// store.dispatch('subscribe', {header, type: getSessionStorage('project')});
// }
// }
router.beforeEach( async (to, from, next) => {
router.beforeEach(async (to, from, next) => {
if (to.path == '/thirdLogin') { // 到第三方登录页面时先删除之前的token
removeToken();
}
// 判断第三方登陆
if (to.query.thirdJump) {
setToken(to.query.key);

View File

@ -53,8 +53,7 @@ export default {
deviceCode:deviceCode
}, LoginParams.LianKeTang);
this.message = '正在登陆中......';
// const tokenKey = getToken();
const tokenKey = '';
const tokenKey = getToken();
if (tokenKey) {
const header = { group: '', 'X-Token': tokenKey };
this.$store.dispatch('setToken', tokenKey);