@unsource/ui 2.0.13 → 2.0.16
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/module.json +1 -1
- package/dist/module.mjs +2 -1
- package/dist/runtime/components/UnLog.d.vue.ts +2 -2
- package/dist/runtime/components/UnLog.vue.d.ts +2 -2
- package/dist/runtime/composables/fetch.d.ts +20 -10
- package/dist/runtime/composables/fetch.js +34 -42
- package/dist/runtime/composables/global.js +1 -2
- package/package.json +3 -2
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -2,10 +2,10 @@ declare const _default: typeof __VLS_export;
|
|
|
2
2
|
export default _default;
|
|
3
3
|
declare const __VLS_export: import("vue").DefineComponent<{}, {
|
|
4
4
|
$props: Partial<typeof __VLS_props>;
|
|
5
|
-
fixed: boolean;
|
|
6
5
|
data: string | number | boolean | unknown[] | Record<string, any>;
|
|
6
|
+
fixed: boolean;
|
|
7
7
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
8
8
|
declare const __VLS_props: {
|
|
9
|
-
readonly fixed: boolean;
|
|
10
9
|
readonly data: string | number | boolean | unknown[] | Record<string, any>;
|
|
10
|
+
readonly fixed: boolean;
|
|
11
11
|
};
|
|
@@ -2,10 +2,10 @@ declare const _default: typeof __VLS_export;
|
|
|
2
2
|
export default _default;
|
|
3
3
|
declare const __VLS_export: import("vue").DefineComponent<{}, {
|
|
4
4
|
$props: Partial<typeof __VLS_props>;
|
|
5
|
-
fixed: boolean;
|
|
6
5
|
data: string | number | boolean | unknown[] | Record<string, any>;
|
|
6
|
+
fixed: boolean;
|
|
7
7
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
8
8
|
declare const __VLS_props: {
|
|
9
|
-
readonly fixed: boolean;
|
|
10
9
|
readonly data: string | number | boolean | unknown[] | Record<string, any>;
|
|
10
|
+
readonly fixed: boolean;
|
|
11
11
|
};
|
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
import type { NitroFetchOptions, NitroFetchRequest } from 'nitropack';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const fetch: <T>({ body, config, controller, URL, method }: {
|
|
3
|
+
body?: undefined;
|
|
4
|
+
config?: {} | undefined;
|
|
5
|
+
controller?: undefined;
|
|
6
|
+
URL?: string | undefined;
|
|
7
|
+
method?: string | undefined;
|
|
8
|
+
}) => Promise<{
|
|
9
|
+
error: never;
|
|
10
|
+
} | {
|
|
11
|
+
result: import("nitropack").TypedInternalResponse<NitroFetchRequest, T, NitroFetchOptions<NitroFetchRequest, "get" | "head" | "patch" | "post" | "put" | "delete" | "connect" | "options" | "trace"> extends NitroFetchOptions<R, import("nitropack").AvailableRouterMethod<R>> ? "get" : Lowercase<Exclude<import("nitropack").AvailableRouterMethod<R>, undefined>> | Lowercase<Exclude<Uppercase<import("nitropack").AvailableRouterMethod<R>>, undefined>> extends "get" | "head" | "patch" | "post" | "put" | "delete" | "connect" | "options" | "trace" ? Lowercase<Exclude<import("nitropack").AvailableRouterMethod<R>, undefined>> | Lowercase<Exclude<Uppercase<import("nitropack").AvailableRouterMethod<R>>, undefined>> : "get">;
|
|
12
|
+
}>;
|
|
3
13
|
export declare const useGet: <T>(URL: string, config?: NitroFetchOptions<NitroFetchRequest, "get"> | {
|
|
4
|
-
headers?: Record<string,
|
|
5
|
-
}, controller?:
|
|
14
|
+
headers?: Record<string, never>;
|
|
15
|
+
}, controller?: AbortController | undefined) => Promise<{
|
|
6
16
|
result?: T;
|
|
7
|
-
error?:
|
|
17
|
+
error?: never;
|
|
8
18
|
}>;
|
|
9
|
-
export declare const useDelete: <T>(URL: string, config?: NitroFetchOptions<NitroFetchRequest, "delete"
|
|
19
|
+
export declare const useDelete: <T>(URL: string, config?: NitroFetchOptions<NitroFetchRequest, "delete">, controller?: AbortController | undefined) => Promise<{
|
|
10
20
|
result?: T;
|
|
11
|
-
error?:
|
|
21
|
+
error?: never;
|
|
12
22
|
}>;
|
|
13
|
-
export declare const usePost: <T, R = T>(URL: string, data: R, config?: NitroFetchOptions<NitroFetchRequest, "post"
|
|
23
|
+
export declare const usePost: <T, R = T>(URL: string, data: R, config?: NitroFetchOptions<NitroFetchRequest, "post">, controller?: AbortController | undefined) => Promise<{
|
|
14
24
|
result?: T;
|
|
15
|
-
error?:
|
|
25
|
+
error?: never;
|
|
16
26
|
}>;
|
|
17
|
-
export declare const usePut: <T, R = T>(URL: string, data: Partial<R>, config?: NitroFetchOptions<NitroFetchRequest, "put"
|
|
27
|
+
export declare const usePut: <T, R = T>(URL: string, data: Partial<R>, config?: NitroFetchOptions<NitroFetchRequest, "put">, controller?: AbortController | undefined) => Promise<{
|
|
18
28
|
result?: T;
|
|
19
|
-
error?:
|
|
29
|
+
error?: never;
|
|
20
30
|
}>;
|
|
@@ -2,7 +2,6 @@ import { useToken } from "./reuseable.js";
|
|
|
2
2
|
import { _get, _set, useNuxtApp, _takeRight } from "#imports";
|
|
3
3
|
const domain = location.hostname.split(".");
|
|
4
4
|
const tld = _takeRight(domain, 2).join(".");
|
|
5
|
-
export const BASE_URL = eval(process.env.BASE_URL) || "https://api.book.parand.app";
|
|
6
5
|
const setHeaders = (config) => {
|
|
7
6
|
const token = useToken();
|
|
8
7
|
_set(config, ["headers", "Authorization"], _get(config, ["headers", "Authorization"], token.value || ""));
|
|
@@ -17,15 +16,16 @@ const errorHandler = (error, config) => {
|
|
|
17
16
|
}
|
|
18
17
|
return { error };
|
|
19
18
|
};
|
|
20
|
-
export const
|
|
19
|
+
export const fetch = async ({ body = void 0, config = {}, controller = void 0, URL = "", method = "GET" }) => {
|
|
21
20
|
controller = new AbortController();
|
|
22
21
|
const signal = controller.signal;
|
|
23
22
|
config = setHeaders(config);
|
|
24
23
|
try {
|
|
25
24
|
const result = await $fetch(URL, {
|
|
26
|
-
baseURL: BASE_URL,
|
|
27
|
-
method
|
|
25
|
+
baseURL: window.BASE_URL,
|
|
26
|
+
method,
|
|
28
27
|
signal,
|
|
28
|
+
body,
|
|
29
29
|
...config
|
|
30
30
|
});
|
|
31
31
|
return { result };
|
|
@@ -33,44 +33,36 @@ export const useGet = async (URL, config = {}, controller = void 0) => {
|
|
|
33
33
|
return errorHandler(error, config);
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
export const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
...config
|
|
43
|
-
});
|
|
44
|
-
return { result };
|
|
45
|
-
} catch (error) {
|
|
46
|
-
return errorHandler(error, config);
|
|
47
|
-
}
|
|
36
|
+
export const useGet = async (URL, config = {}, controller = void 0) => {
|
|
37
|
+
return fetch({
|
|
38
|
+
URL,
|
|
39
|
+
config,
|
|
40
|
+
controller
|
|
41
|
+
});
|
|
48
42
|
};
|
|
49
|
-
export const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
...config
|
|
57
|
-
});
|
|
58
|
-
return { result };
|
|
59
|
-
} catch (error) {
|
|
60
|
-
return errorHandler(error, config);
|
|
61
|
-
}
|
|
43
|
+
export const useDelete = async (URL, config = {}, controller = void 0) => {
|
|
44
|
+
return fetch({
|
|
45
|
+
URL,
|
|
46
|
+
config,
|
|
47
|
+
controller,
|
|
48
|
+
method: "DELETE"
|
|
49
|
+
});
|
|
62
50
|
};
|
|
63
|
-
export const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
51
|
+
export const usePost = async (URL, data, config = {}, controller = void 0) => {
|
|
52
|
+
return fetch({
|
|
53
|
+
URL,
|
|
54
|
+
config,
|
|
55
|
+
controller,
|
|
56
|
+
body: data,
|
|
57
|
+
method: "POST"
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
export const usePut = async (URL, data, config = {}, controller = void 0) => {
|
|
61
|
+
return fetch({
|
|
62
|
+
URL,
|
|
63
|
+
body: data,
|
|
64
|
+
config,
|
|
65
|
+
controller,
|
|
66
|
+
method: "PUT"
|
|
67
|
+
});
|
|
76
68
|
};
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
_mergeWith,
|
|
6
6
|
_set,
|
|
7
7
|
_toPairs,
|
|
8
|
-
BASE_URL,
|
|
9
8
|
computed,
|
|
10
9
|
isPlainObject,
|
|
11
10
|
navigateTo,
|
|
@@ -152,7 +151,7 @@ export const minutesToTime = (m = 0) => {
|
|
|
152
151
|
return `${hour.padStart(2, 0)}:${minute.padStart(2, 0)}`;
|
|
153
152
|
};
|
|
154
153
|
export const useSocketIo = () => {
|
|
155
|
-
const socket = io(BASE_URL, {
|
|
154
|
+
const socket = io(window.BASE_URL, {
|
|
156
155
|
extraHeaders: {
|
|
157
156
|
authorization: useToken().value || ""
|
|
158
157
|
// 'app-code': APP_CODE
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unsource/ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.16",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "nuxt ui kit for unsource env",
|
|
6
6
|
"repository": "https://github.com/alisa2142/unsource-ui",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"@nuxtjs/i18n": "^8.5.6",
|
|
43
43
|
"@persian-tools/persian-tools": "^4.0.4",
|
|
44
44
|
"@types/big.js": "^6.2.2",
|
|
45
|
+
"@types/numeral": "^2.0.5",
|
|
45
46
|
"@vueuse/components": "^13.9.0",
|
|
46
47
|
"@vueuse/core": "^13.9.0",
|
|
47
48
|
"@vueuse/nuxt": "^13.9.0",
|
|
@@ -76,12 +77,12 @@
|
|
|
76
77
|
},
|
|
77
78
|
"devDependencies": {
|
|
78
79
|
"@nuxt/devtools": "^2.6.5",
|
|
79
|
-
"@nuxt/vite-builder": "~3.15.4",
|
|
80
80
|
"@nuxt/eslint-config": "^1.9.0",
|
|
81
81
|
"@nuxt/icon": "1.15.0",
|
|
82
82
|
"@nuxt/module-builder": "^1.0.2",
|
|
83
83
|
"@nuxt/schema": "^3.19.3",
|
|
84
84
|
"@nuxt/test-utils": "^3.19.2",
|
|
85
|
+
"@nuxt/vite-builder": "~3.15.4",
|
|
85
86
|
"@types/node": "latest",
|
|
86
87
|
"@unhead/vue": "^1.11.20",
|
|
87
88
|
"@unocss/nuxt": "^66.5.3",
|