@vesperjs/vue 0.3.2 → 0.3.3

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 CHANGED
@@ -23,6 +23,7 @@ type SearchParams = Record<string, any>;
23
23
  interface QueryAPIOptions {
24
24
  query?: SearchParams;
25
25
  token?: string | null | undefined;
26
+ baseURL?: string | null | undefined;
26
27
  signal?: AbortSignal;
27
28
  onRequestError?: ({
28
29
  error
@@ -49,6 +50,7 @@ interface MutationAPIOptions {
49
50
  method: 'post' | 'put' | 'delete';
50
51
  body?: Record<string, any> | FormData;
51
52
  token?: string | null;
53
+ baseURL?: string | null;
52
54
  onRequestError?: ({
53
55
  error
54
56
  }: {
@@ -64,6 +66,7 @@ declare const useMutationApi: <T = unknown, E = any>(url: string, {
64
66
  method,
65
67
  body,
66
68
  token,
69
+ baseURL,
67
70
  onRequestError,
68
71
  onResponseError
69
72
  }: MutationAPIOptions) => Promise<{
package/dist/index.mjs CHANGED
@@ -88,12 +88,12 @@ const useHttpHeaders = function() {
88
88
  //#region src/composables/backend/api/use-query-api.ts
89
89
  const useQueryApi = async function(url, options) {
90
90
  const { commonHeaders } = useHttpHeaders();
91
- const { baseURL } = useApiConstants();
91
+ const { baseURL: baseUrl } = useApiConstants();
92
92
  const tokenRef = ref();
93
93
  const headers = commonHeaders.value;
94
94
  if (options?.token) headers.Authorization = `Bearer ${options.token}`;
95
95
  const getOptions = {
96
- baseURL: baseURL.value,
96
+ baseURL: options?.baseURL ?? baseUrl.value,
97
97
  method: "get",
98
98
  query: options?.query ?? {},
99
99
  headers,
@@ -114,9 +114,9 @@ const useQueryApi = async function(url, options) {
114
114
  };
115
115
  //#endregion
116
116
  //#region src/composables/backend/api/use-mutation-api.ts
117
- const useMutationApi = async function(url, { method, body = {}, token = null, onRequestError, onResponseError }) {
117
+ const useMutationApi = async function(url, { method, body = {}, token = null, baseURL = null, onRequestError, onResponseError }) {
118
118
  const { commonHeaders } = useHttpHeaders();
119
- const { baseURL } = useApiConstants();
119
+ const { baseURL: baseUrl } = useApiConstants();
120
120
  const headers = commonHeaders.value;
121
121
  const tokenRef = ref();
122
122
  if (token) {
@@ -124,7 +124,7 @@ const useMutationApi = async function(url, { method, body = {}, token = null, on
124
124
  tokenRef.value = token;
125
125
  }
126
126
  const options = {
127
- baseURL: baseURL.value,
127
+ baseURL: baseURL ?? baseUrl.value,
128
128
  headers,
129
129
  method
130
130
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vesperjs/vue",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
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.3.2",
25
+ "@vesperjs/shared": "0.3.3",
26
26
  "nanostores": "^1.3.0",
27
27
  "ofetch": "^1.5.1",
28
28
  "undici": "^8.1.0",
@@ -30,15 +30,15 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "@eslint/js": "^10.0.1",
33
- "@typescript-eslint/eslint-plugin": "^8.59.0",
34
- "@typescript-eslint/parser": "^8.59.0",
35
- "@typescript-eslint/project-service": "^8.59.0",
36
- "@typescript-eslint/typescript-estree": "^8.59.0",
37
- "@typescript-eslint/utils": "^8.59.0",
33
+ "@typescript-eslint/eslint-plugin": "^8.59.1",
34
+ "@typescript-eslint/parser": "^8.59.1",
35
+ "@typescript-eslint/project-service": "^8.59.1",
36
+ "@typescript-eslint/typescript-estree": "^8.59.1",
37
+ "@typescript-eslint/utils": "^8.59.1",
38
38
  "@vue/eslint-config-typescript": "^14.7.0",
39
39
  "eslint": "^10.2.1",
40
40
  "eslint-plugin-vue": "^10.9.0",
41
- "oxfmt": "^0.46.0",
41
+ "oxfmt": "^0.47.0",
42
42
  "tsdown": "^0.21.10",
43
43
  "typescript": "^6.0.3"
44
44
  },