etherreq 1.0.18 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/etherreq.js +1 -2
- package/src/request.js +2 -6
package/package.json
CHANGED
package/src/etherreq.js
CHANGED
|
@@ -26,8 +26,7 @@ export const create = (defaultConfig = {}) => {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
const res = await fetch(url, options);
|
|
29
|
-
|
|
30
|
-
console.log(data);
|
|
29
|
+
// const data = await res.json();
|
|
31
30
|
if (!res.ok) {
|
|
32
31
|
const error = new Error(`HTTP 错误: ${res.status} - ${res.statusText}`);
|
|
33
32
|
error.response = {
|
package/src/request.js
CHANGED
|
@@ -23,12 +23,8 @@ instance.interceptors.request.use((config) => {
|
|
|
23
23
|
const cached = requestCache.get(cacheKey);
|
|
24
24
|
console.log("缓存数据:",cached);
|
|
25
25
|
|
|
26
|
-
if (cached) {
|
|
27
|
-
|
|
28
|
-
// ✅ 返回缓存的 data 数据
|
|
29
|
-
console.log(Promise.resolve(cached));
|
|
30
|
-
|
|
31
|
-
return Promise.resolve(cached); // 这里返回的就是 response.data
|
|
26
|
+
if (cached) {
|
|
27
|
+
return cached; // 这里返回的就是 response.data
|
|
32
28
|
}
|
|
33
29
|
}
|
|
34
30
|
|