@vesperjs/vue 0.5.0 → 0.6.0
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.d.mts +2 -0
- package/dist/index.mjs +11 -2
- package/package.json +8 -8
package/dist/index.d.mts
CHANGED
|
@@ -19,7 +19,9 @@ declare const useOFetch: <T = unknown, E = any>(url: string, options?: FetchOpti
|
|
|
19
19
|
//#region src/composables/backend/api/use-query-api.d.ts
|
|
20
20
|
type SearchParams = Record<string, any>;
|
|
21
21
|
interface QueryAPIOptions {
|
|
22
|
+
method?: 'get' | 'query';
|
|
22
23
|
query?: SearchParams;
|
|
24
|
+
body?: Record<string, any> | FormData;
|
|
23
25
|
token?: string | null | undefined;
|
|
24
26
|
baseURL?: string | null | undefined;
|
|
25
27
|
signal?: AbortSignal;
|
package/dist/index.mjs
CHANGED
|
@@ -94,13 +94,22 @@ const useQueryApi = async function(url, options) {
|
|
|
94
94
|
if (options?.token) headers.Authorization = `Bearer ${options.token}`;
|
|
95
95
|
const queryOptions = {
|
|
96
96
|
baseURL: options?.baseURL ?? baseUrl.value,
|
|
97
|
-
method: "get",
|
|
98
|
-
query: options?.query ?? {},
|
|
99
97
|
headers,
|
|
100
98
|
onResponse({ response }) {
|
|
101
99
|
tokenRef.value = response.headers.get("Authorization")?.split(" ")[1] ?? options?.token;
|
|
102
100
|
}
|
|
103
101
|
};
|
|
102
|
+
if (options?.method) {
|
|
103
|
+
queryOptions.method = options.method;
|
|
104
|
+
if (options.method === "get") queryOptions.query = options.query ?? {};
|
|
105
|
+
if (options.method === "query") queryOptions.body = options.body ?? {};
|
|
106
|
+
} else if (options?.query) {
|
|
107
|
+
queryOptions.method = "get";
|
|
108
|
+
queryOptions.query = options.query;
|
|
109
|
+
} else if (options?.body) {
|
|
110
|
+
queryOptions.method = "query";
|
|
111
|
+
queryOptions.body = options.body;
|
|
112
|
+
}
|
|
104
113
|
if (options?.retry) queryOptions.retry = options.retry;
|
|
105
114
|
if (options?.retryDelay) queryOptions.retryDelay = options.retryDelay;
|
|
106
115
|
if (options?.retryStatusCodes) queryOptions.retryStatusCodes = options.retryStatusCodes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vesperjs/vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"vue.js"
|
|
6
6
|
],
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@formkit/tempo": "^1.0.0",
|
|
23
23
|
"@nanostores/persistent": "^1.3.4",
|
|
24
24
|
"@nanostores/router": "^1.0.0",
|
|
25
|
-
"@vesperjs/shared": "0.
|
|
25
|
+
"@vesperjs/shared": "0.6.0",
|
|
26
26
|
"nanostores": "^1.3.0",
|
|
27
27
|
"ofetch": "^1.5.1",
|
|
28
28
|
"undici": "^8.2.0",
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
"@typescript-eslint/parser": "^8.59.2",
|
|
35
35
|
"@vue/eslint-config-typescript": "^14.7.0",
|
|
36
36
|
"eslint": "^10.3.0",
|
|
37
|
-
"eslint-plugin-vue": "^10.9.
|
|
38
|
-
"oxfmt": "^0.
|
|
37
|
+
"eslint-plugin-vue": "^10.9.1",
|
|
38
|
+
"oxfmt": "^0.48.0",
|
|
39
39
|
"tsdown": "^0.21.10",
|
|
40
40
|
"typescript": "^6.0.3"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@vue/reactivity": "^3.5.
|
|
44
|
-
"@vue/runtime-core": "^3.5.
|
|
45
|
-
"@vue/runtime-dom": "^3.5.
|
|
46
|
-
"vue": "^3.5.
|
|
43
|
+
"@vue/reactivity": "^3.5.34 || ^3.6.0-beta.10",
|
|
44
|
+
"@vue/runtime-core": "^3.5.34 || ^3.6.0-beta.10",
|
|
45
|
+
"@vue/runtime-dom": "^3.5.34 || ^3.6.0-beta.10",
|
|
46
|
+
"vue": "^3.5.34 || ^3.6.0-beta.10"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "tsdown --dts",
|