@inzombieland/nuxt-common 1.18.19 → 1.18.21
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/assets/css/layer.css +1 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/api/index.d.ts +7 -0
- package/dist/runtime/api/user-actions.d.ts +8 -8
- package/dist/runtime/api/user-actions.mjs +3 -18
- package/dist/runtime/packages/core/index.d.ts +21 -0
- package/dist/runtime/packages/core/package.json +1 -1
- package/dist/runtime/packages/core/user-actions.d.ts +7 -0
- package/dist/runtime/packages/core/user-actions.mjs +17 -0
- package/dist/runtime/packages/layer-manager/assets/css/layer.css +1 -0
- package/dist/runtime/packages/layer-manager/package.json +1 -1
- package/package.json +1 -1
package/assets/css/layer.css
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
2
2
|
import { defineNuxtModule, createResolver, addServerHandler, addImportsDir, addPlugin, addComponent } from '@nuxt/kit';
|
|
3
3
|
|
|
4
4
|
const name = "@inzombieland/nuxt-common";
|
|
5
|
-
const version = "1.18.
|
|
5
|
+
const version = "1.18.21";
|
|
6
6
|
|
|
7
7
|
const module = defineNuxtModule({
|
|
8
8
|
meta: {
|
|
@@ -28,11 +28,18 @@ declare const fetch: Fetch, getUser: () => Promise<import("src/runtime/packages/
|
|
|
28
28
|
fetchActiveSessions: () => Promise<{
|
|
29
29
|
sessions: import("src/runtime/packages/core/types").ActiveSession[];
|
|
30
30
|
}>;
|
|
31
|
+
changeName: (body: {
|
|
32
|
+
firstName: string;
|
|
33
|
+
lastName: string;
|
|
34
|
+
middleName: string;
|
|
35
|
+
}) => Promise<void>;
|
|
31
36
|
changeTheme: (body: {
|
|
32
37
|
theme: "light" | "dark";
|
|
33
38
|
}) => Promise<void>;
|
|
34
39
|
changeLocale: (body: {
|
|
35
40
|
locale: string;
|
|
36
41
|
}) => Promise<void>;
|
|
42
|
+
changeAvatar: (body: FormData) => Promise<void>;
|
|
43
|
+
deleteAvatar: () => Promise<void>;
|
|
37
44
|
};
|
|
38
45
|
export { fetch, getUser, useApiFetch, userActions };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ActiveSession } from "../packages/core";
|
|
2
2
|
export declare const signIn: (body: {
|
|
3
3
|
username: string;
|
|
4
4
|
password: string;
|
|
@@ -7,6 +7,13 @@ export declare const signIn: (body: {
|
|
|
7
7
|
key: string;
|
|
8
8
|
}>;
|
|
9
9
|
export declare const logout: () => Promise<void>;
|
|
10
|
+
export declare const changeName: (body: {
|
|
11
|
+
firstName: string;
|
|
12
|
+
lastName: string;
|
|
13
|
+
middleName: string;
|
|
14
|
+
}) => Promise<void>;
|
|
15
|
+
export declare const changeAvatar: (body: FormData) => Promise<void>;
|
|
16
|
+
export declare const deleteAvatar: () => Promise<void>;
|
|
10
17
|
export declare const signInByCodeSendCode: (body: {
|
|
11
18
|
username: string;
|
|
12
19
|
}) => Promise<{
|
|
@@ -48,11 +55,6 @@ export declare const resetPassword: (body: {
|
|
|
48
55
|
key: string;
|
|
49
56
|
password: string;
|
|
50
57
|
}) => Promise<{}>;
|
|
51
|
-
export declare const changeName: (body: {
|
|
52
|
-
firstName: string;
|
|
53
|
-
lastName: string;
|
|
54
|
-
middleName: string;
|
|
55
|
-
}) => Promise<void>;
|
|
56
58
|
export declare const changeBirthday: (body: {
|
|
57
59
|
day?: number;
|
|
58
60
|
month?: number;
|
|
@@ -87,8 +89,6 @@ export declare const changePhone: (body: {
|
|
|
87
89
|
phone: string;
|
|
88
90
|
password: string;
|
|
89
91
|
}) => Promise<void>;
|
|
90
|
-
export declare const changeAvatar: (body: FormData) => Promise<void>;
|
|
91
|
-
export declare const deleteAvatar: () => Promise<void>;
|
|
92
92
|
export declare const fetchActiveSessions: () => Promise<{
|
|
93
93
|
sessions: ActiveSession[];
|
|
94
94
|
}>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { useRequestHeaders } from "#imports";
|
|
2
|
-
import { useUser } from "../packages/core/index.mjs";
|
|
3
2
|
import { flush, setToken, updateUser } from "../packages/core/api-client.mjs";
|
|
4
3
|
import { fetch, getUser, userActions } from "./index.mjs";
|
|
5
4
|
export const signIn = userActions.signIn;
|
|
6
5
|
export const logout = userActions.logout;
|
|
6
|
+
export const changeName = userActions.changeName;
|
|
7
|
+
export const changeAvatar = userActions.changeAvatar;
|
|
8
|
+
export const deleteAvatar = userActions.deleteAvatar;
|
|
7
9
|
export const signInByCodeSendCode = async (body) => {
|
|
8
10
|
return await fetch("/account/0/signinbycode/sendcode", {
|
|
9
11
|
body,
|
|
@@ -74,14 +76,6 @@ export const resetPassword = async (body) => {
|
|
|
74
76
|
headers: useRequestHeaders(["cookie"])
|
|
75
77
|
});
|
|
76
78
|
};
|
|
77
|
-
export const changeName = async (body) => {
|
|
78
|
-
await fetch("/account/1/change/name", {
|
|
79
|
-
body,
|
|
80
|
-
method: "POST",
|
|
81
|
-
headers: { event: "WS.ChangeNameResult" }
|
|
82
|
-
});
|
|
83
|
-
updateUser(body);
|
|
84
|
-
};
|
|
85
79
|
export const changeBirthday = async (body) => {
|
|
86
80
|
await fetch("/account/1/change/birthday", { body, method: "POST" });
|
|
87
81
|
const { year, month, day } = body;
|
|
@@ -114,15 +108,6 @@ export const changePhone = async (body) => {
|
|
|
114
108
|
await fetch("/account/1/change/phone", { body, method: "POST" });
|
|
115
109
|
updateUser({ phone: body.phone });
|
|
116
110
|
};
|
|
117
|
-
export const changeAvatar = async (body) => {
|
|
118
|
-
const { avatar } = await fetch("/account/1/upload/avatar", { body, method: "POST" });
|
|
119
|
-
updateUser({ avatar });
|
|
120
|
-
};
|
|
121
|
-
export const deleteAvatar = async () => {
|
|
122
|
-
const user = useUser();
|
|
123
|
-
await fetch("/account/1/delete/avatar", { body: { avatar: user.value?.avatar }, method: "DELETE" });
|
|
124
|
-
updateUser({ avatar: "" });
|
|
125
|
-
};
|
|
126
111
|
export const fetchActiveSessions = async () => {
|
|
127
112
|
return await fetch("/account/1/sessions");
|
|
128
113
|
};
|
|
@@ -20,12 +20,19 @@ export declare function initApiFetch($fetch: Fetch, config: FetchConfig): {
|
|
|
20
20
|
fetchActiveSessions: () => Promise<{
|
|
21
21
|
sessions: import("./types").ActiveSession[];
|
|
22
22
|
}>;
|
|
23
|
+
changeName: (body: {
|
|
24
|
+
firstName: string;
|
|
25
|
+
lastName: string;
|
|
26
|
+
middleName: string;
|
|
27
|
+
}) => Promise<void>;
|
|
23
28
|
changeTheme: (body: {
|
|
24
29
|
theme: "light" | "dark";
|
|
25
30
|
}) => Promise<void>;
|
|
26
31
|
changeLocale: (body: {
|
|
27
32
|
locale: string;
|
|
28
33
|
}) => Promise<void>;
|
|
34
|
+
changeAvatar: (body: FormData) => Promise<void>;
|
|
35
|
+
deleteAvatar: () => Promise<void>;
|
|
29
36
|
};
|
|
30
37
|
};
|
|
31
38
|
export declare const useUserActions: () => Ref<{
|
|
@@ -40,12 +47,19 @@ export declare const useUserActions: () => Ref<{
|
|
|
40
47
|
fetchActiveSessions: () => Promise<{
|
|
41
48
|
sessions: import("./types").ActiveSession[];
|
|
42
49
|
}>;
|
|
50
|
+
changeName: (body: {
|
|
51
|
+
firstName: string;
|
|
52
|
+
lastName: string;
|
|
53
|
+
middleName: string;
|
|
54
|
+
}) => Promise<void>;
|
|
43
55
|
changeTheme: (body: {
|
|
44
56
|
theme: "light" | "dark";
|
|
45
57
|
}) => Promise<void>;
|
|
46
58
|
changeLocale: (body: {
|
|
47
59
|
locale: string;
|
|
48
60
|
}) => Promise<void>;
|
|
61
|
+
changeAvatar: (body: FormData) => Promise<void>;
|
|
62
|
+
deleteAvatar: () => Promise<void>;
|
|
49
63
|
}, {
|
|
50
64
|
signIn: (body: {
|
|
51
65
|
username: string;
|
|
@@ -58,10 +72,17 @@ export declare const useUserActions: () => Ref<{
|
|
|
58
72
|
fetchActiveSessions: () => Promise<{
|
|
59
73
|
sessions: import("./types").ActiveSession[];
|
|
60
74
|
}>;
|
|
75
|
+
changeName: (body: {
|
|
76
|
+
firstName: string;
|
|
77
|
+
lastName: string;
|
|
78
|
+
middleName: string;
|
|
79
|
+
}) => Promise<void>;
|
|
61
80
|
changeTheme: (body: {
|
|
62
81
|
theme: "light" | "dark";
|
|
63
82
|
}) => Promise<void>;
|
|
64
83
|
changeLocale: (body: {
|
|
65
84
|
locale: string;
|
|
66
85
|
}) => Promise<void>;
|
|
86
|
+
changeAvatar: (body: FormData) => Promise<void>;
|
|
87
|
+
deleteAvatar: () => Promise<void>;
|
|
67
88
|
}> | undefined;
|
|
@@ -12,10 +12,17 @@ export declare const createApiUserActions: (fetch: Fetch, config: FetchConfig, g
|
|
|
12
12
|
fetchActiveSessions: () => Promise<{
|
|
13
13
|
sessions: ActiveSession[];
|
|
14
14
|
}>;
|
|
15
|
+
changeName: (body: {
|
|
16
|
+
firstName: string;
|
|
17
|
+
lastName: string;
|
|
18
|
+
middleName: string;
|
|
19
|
+
}) => Promise<void>;
|
|
15
20
|
changeTheme: (body: {
|
|
16
21
|
theme: "light" | "dark";
|
|
17
22
|
}) => Promise<void>;
|
|
18
23
|
changeLocale: (body: {
|
|
19
24
|
locale: string;
|
|
20
25
|
}) => Promise<void>;
|
|
26
|
+
changeAvatar: (body: FormData) => Promise<void>;
|
|
27
|
+
deleteAvatar: () => Promise<void>;
|
|
21
28
|
};
|
|
@@ -33,6 +33,14 @@ export const createApiUserActions = once(
|
|
|
33
33
|
fetchActiveSessions: async () => {
|
|
34
34
|
return await fetch("/account/1/sessions");
|
|
35
35
|
},
|
|
36
|
+
changeName: async (body) => {
|
|
37
|
+
await fetch("/account/1/change/name", {
|
|
38
|
+
body,
|
|
39
|
+
method: "POST",
|
|
40
|
+
headers: { event: "WS.ChangeNameResult" }
|
|
41
|
+
});
|
|
42
|
+
updateUser(body);
|
|
43
|
+
},
|
|
36
44
|
changeTheme: async (body) => {
|
|
37
45
|
const user = useUser();
|
|
38
46
|
if (user.value) {
|
|
@@ -46,6 +54,15 @@ export const createApiUserActions = once(
|
|
|
46
54
|
await fetch("/account/1/change/locale", { body, method: "POST" });
|
|
47
55
|
updateUser(body);
|
|
48
56
|
}
|
|
57
|
+
},
|
|
58
|
+
changeAvatar: async (body) => {
|
|
59
|
+
const { avatar } = await fetch("/account/1/upload/avatar", { body, method: "POST" });
|
|
60
|
+
updateUser({ avatar });
|
|
61
|
+
},
|
|
62
|
+
deleteAvatar: async () => {
|
|
63
|
+
const user = useUser();
|
|
64
|
+
await fetch("/account/1/delete/avatar", { body: { avatar: user.value?.avatar }, method: "DELETE" });
|
|
65
|
+
updateUser({ avatar: "" });
|
|
49
66
|
}
|
|
50
67
|
};
|
|
51
68
|
}
|