|
@@ -24,6 +24,7 @@ export default {
|
|
|
const token=localStorage.getItem('token');//获取token
|
|
const token=localStorage.getItem('token');//获取token
|
|
|
console.log("打印获取的token",token);
|
|
console.log("打印获取的token",token);
|
|
|
setToken(token);
|
|
setToken(token);
|
|
|
|
|
+ this.$store.commit('user/SET_TOKEN', token); // 同步更新 store 状态,否则请求拦截器中 store.getters.token 为空,不会携带 Authorization 头
|
|
|
alert(token);
|
|
alert(token);
|
|
|
this.$store.dispatch('user/getUserInfoByToken').then(user => {
|
|
this.$store.dispatch('user/getUserInfoByToken').then(user => {
|
|
|
|
|
|