mirror of
https://github.com/chillzhuang/Saber.git
synced 2024-11-05 10:09:40 +08:00
⚡ 优化代码
This commit is contained in:
parent
52dc1da5e2
commit
fe1a5fff08
@ -1,5 +1,6 @@
|
|||||||
import request from '@/router/axios';
|
import request from '@/router/axios';
|
||||||
import { baseUrl } from '@/config/env';
|
import {baseUrl} from '@/config/env';
|
||||||
|
|
||||||
export const loginByUsername = (account, password, type) => request({
|
export const loginByUsername = (account, password, type) => request({
|
||||||
url: 'api/blade-auth/token',
|
url: 'api/blade-auth/token',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
@ -7,6 +8,9 @@ export const loginByUsername = (account, password, type) => request({
|
|||||||
account,
|
account,
|
||||||
password,
|
password,
|
||||||
type
|
type
|
||||||
|
},
|
||||||
|
meta:{
|
||||||
|
isSerialize:true,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 10分钟检测一次token
|
// 10分钟检测一次token
|
||||||
refreshToken() {
|
refreshToken() {
|
||||||
this.refreshTime = setInterval(() => {
|
/*this.refreshTime = setInterval(() => {
|
||||||
const token = getStore({
|
const token = getStore({
|
||||||
name: "token",
|
name: "token",
|
||||||
debug: true
|
debug: true
|
||||||
@ -103,7 +103,7 @@ export default {
|
|||||||
this.refreshLock = false;
|
this.refreshLock = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, 10000);
|
}, 10000);*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -34,7 +34,7 @@ axios.interceptors.request.use(config => {
|
|||||||
config.headers['blade-auth'] = 'Bearer ' + getToken() // 让每个请求携带token--['Authorization']为自定义key 请根据实际情况自行修改
|
config.headers['blade-auth'] = 'Bearer ' + getToken() // 让每个请求携带token--['Authorization']为自定义key 请根据实际情况自行修改
|
||||||
}
|
}
|
||||||
//headers中配置serialize为true开启序列化
|
//headers中配置serialize为true开启序列化
|
||||||
if (config.methods === 'post' && meta.isSerialize === true) {
|
if (config.method === 'post' && meta.isSerialize === true) {
|
||||||
config.data = serialize(config.data);
|
config.data = serialize(config.data);
|
||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// 基础路径 注意发布之前要先修改这里
|
// 基础路径 注意发布之前要先修改这里
|
||||||
let baseUrl = './'
|
let baseUrl = './'
|
||||||
let url = 'https://sword.bladex.vip'
|
let url = 'http://localhost'
|
||||||
module.exports = {
|
module.exports = {
|
||||||
baseUrl: baseUrl, // 根据你的实际情况更改这里
|
baseUrl: baseUrl, // 根据你的实际情况更改这里
|
||||||
lintOnSave: true,
|
lintOnSave: true,
|
||||||
@ -31,7 +31,7 @@ module.exports = {
|
|||||||
target: url,
|
target: url,
|
||||||
ws: true,
|
ws: true,
|
||||||
pathRewrite: {
|
pathRewrite: {
|
||||||
'^/api': '/api'
|
'^/api': '/'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user