@0xchain/request 1.1.0-beta.60 → 1.1.0-beta.61
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/dist/index.js
CHANGED
|
@@ -9,15 +9,18 @@ const isSimplifiedChinese = () => {
|
|
|
9
9
|
const matchSystemLanguage = () => {
|
|
10
10
|
return isSimplifiedChinese() ? "zh-hans" : "";
|
|
11
11
|
};
|
|
12
|
+
function isServerRuntime() {
|
|
13
|
+
if (typeof window !== "undefined") {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
12
18
|
let httpAgent;
|
|
13
19
|
let httpsAgent;
|
|
14
20
|
let serverHeaderProvider;
|
|
15
21
|
function setServerHeaderProvider(provider) {
|
|
16
22
|
serverHeaderProvider = provider;
|
|
17
23
|
}
|
|
18
|
-
function isServerRuntime() {
|
|
19
|
-
return typeof window === "undefined" || process.env.IS_SERVER === "true";
|
|
20
|
-
}
|
|
21
24
|
function isEdgeRuntime() {
|
|
22
25
|
return process.env.NEXT_RUNTIME === "edge" || typeof globalThis.EdgeRuntime !== "undefined";
|
|
23
26
|
}
|
|
@@ -264,7 +267,7 @@ const axiosInstance$1 = axios.create({
|
|
|
264
267
|
}
|
|
265
268
|
});
|
|
266
269
|
async function refreshToken(config) {
|
|
267
|
-
if (
|
|
270
|
+
if (isServerRuntime()) {
|
|
268
271
|
return config;
|
|
269
272
|
}
|
|
270
273
|
if (typeof config.url === "string" && config.url.includes("/api/refresh/token")) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commonHeader.d.ts","sourceRoot":"","sources":["../../src/interceptors/commonHeader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,0BAA0B,EAAE,MAAM,OAAO,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"commonHeader.d.ts","sourceRoot":"","sources":["../../src/interceptors/commonHeader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,0BAA0B,EAAE,MAAM,OAAO,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAQrD,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,oBAAoB,QAErE;AAyBD,wBAAsB,YAAY,CAChC,MAAM,EAAE,0BAA0B,4CAwDnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refreshToken.d.ts","sourceRoot":"","sources":["../../src/interceptors/refreshToken.ts"],"names":[],"mappings":"AAAA,OAAc,EAAoB,0BAA0B,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"refreshToken.d.ts","sourceRoot":"","sources":["../../src/interceptors/refreshToken.ts"],"names":[],"mappings":"AAAA,OAAc,EAAoB,0BAA0B,EAAE,MAAM,OAAO,CAAC;AAwB5E,wBAA8B,YAAY,CACxC,MAAM,EAAE,0BAA0B,4CAkFnC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 判断是否处于“服务端运行时”。
|
|
3
|
+
*
|
|
4
|
+
* 关键点:只要存在真实浏览器 window,就一律视为客户端,
|
|
5
|
+
* 避免业务方在客户端 bundle 中固化 IS_SERVER=true 时被误判为服务端,
|
|
6
|
+
* 从而走 next/headers 读 cookie 失败、请求不带 Authorization。
|
|
7
|
+
*/
|
|
8
|
+
export declare function isServerRuntime(): boolean;
|
|
9
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAKzC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xchain/request",
|
|
3
|
-
"version": "1.1.0-beta.
|
|
3
|
+
"version": "1.1.0-beta.61",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"qs": "6.14.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@0xchain/logger": "1.1.0-beta.
|
|
36
|
-
"@0xchain/token": "1.1.0-beta.
|
|
35
|
+
"@0xchain/logger": "1.1.0-beta.61",
|
|
36
|
+
"@0xchain/token": "1.1.0-beta.61"
|
|
37
37
|
},
|
|
38
38
|
"nx": {
|
|
39
39
|
"tags": [
|