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