mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2025-12-17 16:05:53 +08:00
fix: 🐛 request 清空缓存 uuid丢失判断优化
This commit is contained in:
@@ -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;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user