fix: 🐛 request 清空缓存 uuid丢失判断优化
parent
b4f46ded2b
commit
7b8e954555
|
@ -53,12 +53,19 @@ function cleanStorage() {
|
|||
let http = new Request();
|
||||
|
||||
|
||||
http.setConfig((config) => {
|
||||
// 没有uuid创建
|
||||
/**
|
||||
* 创建uuid方法
|
||||
*/
|
||||
const createUuid = () => {
|
||||
if (!storage.getUuid()) {
|
||||
storage.setUuid(uuid.v1());
|
||||
console.log("uuid", storage.getUuid());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
http.setConfig((config) => {
|
||||
createUuid();
|
||||
/* 设置全局配置 */
|
||||
config.baseURL = api.buyer;
|
||||
config.header = {
|
||||
|
@ -105,9 +112,10 @@ http.interceptors.request.use(
|
|||
|
||||
|
||||
}
|
||||
createUuid();
|
||||
config.header = {
|
||||
...config.header,
|
||||
uuid: storage.getUuid() || uuid.v1(),
|
||||
uuid: storage.getUuid()
|
||||
};
|
||||
return config;
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue