@kevisual/query 0.0.36 → 0.0.38
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/query-adapter.js +7 -4
- package/dist/query-browser.js +7 -4
- package/dist/query.js +7 -4
- package/package.json +1 -1
- package/src/adapter.ts +7 -4
package/dist/query-adapter.js
CHANGED
|
@@ -49,9 +49,9 @@ const adapter = async (opts = {}, overloadOpts) => {
|
|
|
49
49
|
// 浏览器环境下,自动将 body 中的 path 和 key 提取到查询参数中, 更容易排查问题
|
|
50
50
|
let body = opts.body || {};
|
|
51
51
|
if (!params.path && body?.path) {
|
|
52
|
-
|
|
52
|
+
searchParams.set('path', body.path);
|
|
53
53
|
if (body?.key) {
|
|
54
|
-
|
|
54
|
+
searchParams.set('key', body.key);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -103,11 +103,14 @@ const adapter = async (opts = {}, overloadOpts) => {
|
|
|
103
103
|
})
|
|
104
104
|
.catch((err) => {
|
|
105
105
|
if (err.name === 'AbortError') {
|
|
106
|
-
|
|
106
|
+
return {
|
|
107
|
+
code: 408,
|
|
108
|
+
message: '请求超时',
|
|
109
|
+
};
|
|
107
110
|
}
|
|
108
|
-
console.error(err);
|
|
109
111
|
return {
|
|
110
112
|
code: 500,
|
|
113
|
+
message: err.message || '网络错误',
|
|
111
114
|
};
|
|
112
115
|
})
|
|
113
116
|
.finally(() => {
|
package/dist/query-browser.js
CHANGED
|
@@ -48,9 +48,9 @@ const adapter = async (opts = {}, overloadOpts) => {
|
|
|
48
48
|
// 浏览器环境下,自动将 body 中的 path 和 key 提取到查询参数中, 更容易排查问题
|
|
49
49
|
let body = opts.body || {};
|
|
50
50
|
if (!params.path && body?.path) {
|
|
51
|
-
|
|
51
|
+
searchParams.set('path', body.path);
|
|
52
52
|
if (body?.key) {
|
|
53
|
-
|
|
53
|
+
searchParams.set('key', body.key);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -102,11 +102,14 @@ const adapter = async (opts = {}, overloadOpts) => {
|
|
|
102
102
|
})
|
|
103
103
|
.catch((err) => {
|
|
104
104
|
if (err.name === 'AbortError') {
|
|
105
|
-
|
|
105
|
+
return {
|
|
106
|
+
code: 408,
|
|
107
|
+
message: '请求超时',
|
|
108
|
+
};
|
|
106
109
|
}
|
|
107
|
-
console.error(err);
|
|
108
110
|
return {
|
|
109
111
|
code: 500,
|
|
112
|
+
message: err.message || '网络错误',
|
|
110
113
|
};
|
|
111
114
|
})
|
|
112
115
|
.finally(() => {
|
package/dist/query.js
CHANGED
|
@@ -48,9 +48,9 @@ const adapter = async (opts = {}, overloadOpts) => {
|
|
|
48
48
|
// 浏览器环境下,自动将 body 中的 path 和 key 提取到查询参数中, 更容易排查问题
|
|
49
49
|
let body = opts.body || {};
|
|
50
50
|
if (!params.path && body?.path) {
|
|
51
|
-
|
|
51
|
+
searchParams.set('path', body.path);
|
|
52
52
|
if (body?.key) {
|
|
53
|
-
|
|
53
|
+
searchParams.set('key', body.key);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -102,11 +102,14 @@ const adapter = async (opts = {}, overloadOpts) => {
|
|
|
102
102
|
})
|
|
103
103
|
.catch((err) => {
|
|
104
104
|
if (err.name === 'AbortError') {
|
|
105
|
-
|
|
105
|
+
return {
|
|
106
|
+
code: 408,
|
|
107
|
+
message: '请求超时',
|
|
108
|
+
};
|
|
106
109
|
}
|
|
107
|
-
console.error(err);
|
|
108
110
|
return {
|
|
109
111
|
code: 500,
|
|
112
|
+
message: err.message || '网络错误',
|
|
110
113
|
};
|
|
111
114
|
})
|
|
112
115
|
.finally(() => {
|
package/package.json
CHANGED
package/src/adapter.ts
CHANGED
|
@@ -74,9 +74,9 @@ export const adapter = async (opts: AdapterOpts = {}, overloadOpts?: RequestInit
|
|
|
74
74
|
// 浏览器环境下,自动将 body 中的 path 和 key 提取到查询参数中, 更容易排查问题
|
|
75
75
|
let body = opts.body as Record<string, any> || {};
|
|
76
76
|
if (!params.path && body?.path) {
|
|
77
|
-
|
|
77
|
+
searchParams.set('path', body.path);
|
|
78
78
|
if (body?.key) {
|
|
79
|
-
|
|
79
|
+
searchParams.set('key', body.key);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -124,11 +124,14 @@ export const adapter = async (opts: AdapterOpts = {}, overloadOpts?: RequestInit
|
|
|
124
124
|
})
|
|
125
125
|
.catch((err) => {
|
|
126
126
|
if (err.name === 'AbortError') {
|
|
127
|
-
|
|
127
|
+
return {
|
|
128
|
+
code: 408,
|
|
129
|
+
message: '请求超时',
|
|
130
|
+
}
|
|
128
131
|
}
|
|
129
|
-
console.error(err);
|
|
130
132
|
return {
|
|
131
133
|
code: 500,
|
|
134
|
+
message: err.message || '网络错误',
|
|
132
135
|
};
|
|
133
136
|
})
|
|
134
137
|
.finally(() => {
|