Browse Source

提交

master
mch 2 years ago
parent
commit
362c5b368a
  1. 2
      src/api/request.js
  2. 6
      src/utlis/istoken.js
  3. 2
      src/views/login/Login.vue

2
src/api/request.js

@ -14,7 +14,7 @@ const instance = axios.create({
//请求拦截
instance.interceptors.request.use(
async function (config) {
// console.log('old token:',localStorage.getItem("token"))
console.log('old token:',localStorage.getItem("token"))
console.log('old expires_in',localStorage.getItem("expires_in"))
await yztoken();

6
src/utlis/istoken.js

@ -27,13 +27,13 @@ export const yztoken = async () => {
}
)
.then((res) => {
console.log('connect/token',res.data)
//console.log('connect/token',res.data)
writetoken(res.data.expires_in);
window.localStorage.setItem("token", res.data.access_token);
window.localStorage.setItem("refresh_token", res.data.refresh_token);
console.log('new token:',localStorage.getItem("token"))
console.log('new expires_in',localStorage.getItem("expires_in"))
//console.log('new token:',localStorage.getItem("token"))
//console.log('new expires_in',localStorage.getItem("expires_in"))
});
}

2
src/views/login/Login.vue

@ -98,7 +98,7 @@ export default {
}
)
.then((res) => {
console.log(res.data)
//console.log(res.data)
writetoken(res.data.expires_in);
window.localStorage.setItem("token", res.data.access_token);
window.localStorage.setItem("refresh_token",res.data.refresh_token);

Loading…
Cancel
Save