Commit 544fb891 by cocomilk2012

update

parent c43100af
Showing with 5 additions and 2 deletions
...@@ -98,7 +98,7 @@ function getPathByTo(to, authcode_key) { ...@@ -98,7 +98,7 @@ function getPathByTo(to, authcode_key) {
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
console.log('开始路由'); console.log('开始路由');
if (isOpenHttps === 'true' && location.href.startsWith('http://')) { if (isOpenHttps === 'true' && location.href.startsWith('http://')) {
location.href = location.href.replace('http://', 'https://'); location.href = location.href.replace('http://', 'https://');
} }
...@@ -112,7 +112,6 @@ router.beforeEach((to, from, next) => { ...@@ -112,7 +112,6 @@ router.beforeEach((to, from, next) => {
console.log('authcode=', authcode); console.log('authcode=', authcode);
if (!!authcode) { if (!!authcode) {
getAccessToken(authcode) getAccessToken(authcode)
.then((res) => { .then((res) => {
...@@ -121,12 +120,16 @@ router.beforeEach((to, from, next) => { ...@@ -121,12 +120,16 @@ router.beforeEach((to, from, next) => {
//@ts-ignore //@ts-ignore
const accessToken: string = res; const accessToken: string = res;
localStorage.setItem('token', accessToken); localStorage.setItem('token', accessToken);
console.log('redirectPath=', redirectPath);
window.location.href = redirectPath; window.location.href = redirectPath;
}) })
.catch((err) => { .catch((err) => {
console.log('err=', err); console.log('err=', err);
}); });
} else { } else {
console.log('to.path=', to.path);
next(); next();
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment