reykit 1.0.41 → 1.0.42
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 +6 -1
- package/dist/request.d.ts +11 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -27539,7 +27539,12 @@ function zE(Z, P = "root") {
|
|
|
27539
27539
|
if (!W) throw new Error(`Element ID "${P}" not found`);
|
|
27540
27540
|
dS || (dS = AE.createRoot(W)), dS.render(Z);
|
|
27541
27541
|
}
|
|
27542
|
-
async function DE(Z,
|
|
27542
|
+
async function DE(Z, {
|
|
27543
|
+
params: P,
|
|
27544
|
+
body: W,
|
|
27545
|
+
headers: R,
|
|
27546
|
+
method: Rt
|
|
27547
|
+
}) {
|
|
27543
27548
|
if (P && (P = Object.fromEntries(
|
|
27544
27549
|
Object.entries(P).map(
|
|
27545
27550
|
([L, Me]) => [L, String(Me)]
|
package/dist/request.d.ts
CHANGED
|
@@ -2,15 +2,21 @@
|
|
|
2
2
|
* Send request.
|
|
3
3
|
*
|
|
4
4
|
* @param url - Request URL.
|
|
5
|
-
* @param
|
|
6
|
-
* @param
|
|
5
|
+
* @param option - Request option.
|
|
6
|
+
* @param option.params - Request URL add parameters.
|
|
7
|
+
* @param option.body - Request body data.
|
|
7
8
|
* - `URLSearchParams` : Form data. Automatic set `Content-Type` to `application/x-www-form-urlencoded`.
|
|
8
9
|
* - `FormData` : Multi form data. Automatic set `Content-Type` to `multipart/form-data`.
|
|
9
10
|
* - `File` : Multi form data. When no attribute `type`, then automatic set `Content-Type` to `multipart/form-data`.
|
|
10
11
|
* - `Blob` : Bytes data. When no attribute `type`, then automatic set `Content-Type` to `application/octet-stream`.
|
|
11
12
|
* - `Record<string, any> | string` : JSON data. Automatic set `Content-Type` to `application/json`.
|
|
12
|
-
* @param headers - Request header data.
|
|
13
|
-
* @param method - Request method.
|
|
13
|
+
* @param option.headers - Request header data.
|
|
14
|
+
* @param option.method - Request method.
|
|
14
15
|
* - `undefined` : Automatic judge. When parameter `data` not has value, then is `get`, otherwise is `post`.
|
|
15
16
|
*/
|
|
16
|
-
export default function request(url: string, params
|
|
17
|
+
export default function request(url: string, { params, body, headers, method }: {
|
|
18
|
+
params?: Record<string, string | number | boolean>;
|
|
19
|
+
body?: URLSearchParams | File | FormData | Blob | Record<string, any> | string;
|
|
20
|
+
headers?: Record<string, string | number | boolean>;
|
|
21
|
+
method?: 'get' | 'post' | 'put' | 'patch' | 'delete' | 'options' | 'head';
|
|
22
|
+
}): Promise<Response>;
|