@inzombieland/nuxt-common 1.18.28 → 1.18.29
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 +1 -1
- package/dist/runtime/api/index.d.ts +10 -0
- package/dist/runtime/api/user-actions.d.ts +10 -10
- package/dist/runtime/api/user-actions.mjs +4 -24
- package/dist/runtime/packages/core/index.d.ts +30 -0
- package/dist/runtime/packages/core/package.json +1 -1
- package/dist/runtime/packages/core/user-actions.d.ts +10 -0
- package/dist/runtime/packages/core/user-actions.mjs +20 -0
- package/package.json +1 -1
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.29";
|
|
6
6
|
|
|
7
7
|
const module = defineNuxtModule({
|
|
8
8
|
meta: {
|
|
@@ -24,6 +24,16 @@ declare const fetch: Fetch, getUser: () => Promise<import("src/runtime/packages/
|
|
|
24
24
|
}) => Promise<import("src/runtime/packages/core/types").GetUserResponse | {
|
|
25
25
|
key: string;
|
|
26
26
|
}>;
|
|
27
|
+
signInByCodeSendCode: (body: {
|
|
28
|
+
username: string;
|
|
29
|
+
}) => Promise<{
|
|
30
|
+
key: string;
|
|
31
|
+
}>;
|
|
32
|
+
signInByCodeVerifyCode: (body: {
|
|
33
|
+
key: string;
|
|
34
|
+
code: string;
|
|
35
|
+
rememberMe?: boolean;
|
|
36
|
+
}) => Promise<import("src/runtime/packages/core/types").GetUserResponse>;
|
|
27
37
|
logout: () => Promise<void>;
|
|
28
38
|
fetchActiveSessions: () => Promise<{
|
|
29
39
|
sessions: import("src/runtime/packages/core/types").ActiveSession[];
|
|
@@ -6,6 +6,16 @@ export declare const signIn: (body: {
|
|
|
6
6
|
}) => Promise<import("src/runtime/packages/core/types").GetUserResponse | {
|
|
7
7
|
key: string;
|
|
8
8
|
}>;
|
|
9
|
+
export declare const signInByCodeSendCode: (body: {
|
|
10
|
+
username: string;
|
|
11
|
+
}) => Promise<{
|
|
12
|
+
key: string;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const signInByCodeVerifyCode: (body: {
|
|
15
|
+
key: string;
|
|
16
|
+
code: string;
|
|
17
|
+
rememberMe?: boolean;
|
|
18
|
+
}) => Promise<import("src/runtime/packages/core/types").GetUserResponse>;
|
|
9
19
|
export declare const logout: () => Promise<void>;
|
|
10
20
|
export declare const changeName: (body: {
|
|
11
21
|
firstName: string;
|
|
@@ -48,16 +58,6 @@ export declare const changePhone: (body: {
|
|
|
48
58
|
}) => Promise<void>;
|
|
49
59
|
export declare const changeAvatar: (body: FormData) => Promise<void>;
|
|
50
60
|
export declare const deleteAvatar: () => Promise<void>;
|
|
51
|
-
export declare const signInByCodeSendCode: (body: {
|
|
52
|
-
username: string;
|
|
53
|
-
}) => Promise<{
|
|
54
|
-
key: string;
|
|
55
|
-
}>;
|
|
56
|
-
export declare const signInByCodeVerifyCode: (body: {
|
|
57
|
-
key: string;
|
|
58
|
-
code: string;
|
|
59
|
-
rememberMe?: boolean;
|
|
60
|
-
}) => Promise<import("src/runtime/packages/core/types").GetUserResponse>;
|
|
61
61
|
export declare const signUp: (body: {
|
|
62
62
|
email: string;
|
|
63
63
|
password: string;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useRequestHeaders } from "#imports";
|
|
2
|
-
import { flush
|
|
3
|
-
import { fetch,
|
|
2
|
+
import { flush } from "../packages/core/api-client.mjs";
|
|
3
|
+
import { fetch, userActions } from "./index.mjs";
|
|
4
4
|
export const signIn = userActions.signIn;
|
|
5
|
+
export const signInByCodeSendCode = userActions.signInByCodeSendCode;
|
|
6
|
+
export const signInByCodeVerifyCode = userActions.signInByCodeVerifyCode;
|
|
5
7
|
export const logout = userActions.logout;
|
|
6
8
|
export const changeName = userActions.changeName;
|
|
7
9
|
export const changeBirthday = userActions.changeBirthday;
|
|
@@ -13,28 +15,6 @@ export const confirmEmailChange = userActions.confirmEmailChange;
|
|
|
13
15
|
export const changePhone = userActions.changePhone;
|
|
14
16
|
export const changeAvatar = userActions.changeAvatar;
|
|
15
17
|
export const deleteAvatar = userActions.deleteAvatar;
|
|
16
|
-
export const signInByCodeSendCode = async (body) => {
|
|
17
|
-
return await fetch("/account/0/signinbycode/sendcode", {
|
|
18
|
-
body,
|
|
19
|
-
method: "POST",
|
|
20
|
-
baseURL: "/",
|
|
21
|
-
headers: useRequestHeaders(["cookie"])
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
export const signInByCodeVerifyCode = async (body) => {
|
|
25
|
-
const response = await fetch("/account/0/signinbycode/verifycode", {
|
|
26
|
-
body,
|
|
27
|
-
method: "POST",
|
|
28
|
-
baseURL: "/",
|
|
29
|
-
headers: useRequestHeaders(["cookie"])
|
|
30
|
-
});
|
|
31
|
-
const { accessToken, ...rest } = response;
|
|
32
|
-
if (!accessToken) {
|
|
33
|
-
throw rest;
|
|
34
|
-
}
|
|
35
|
-
setToken(accessToken);
|
|
36
|
-
return await getUser();
|
|
37
|
-
};
|
|
38
18
|
export const signUp = async (body) => {
|
|
39
19
|
return await fetch("/account/0/signup", {
|
|
40
20
|
body,
|
|
@@ -16,6 +16,16 @@ export declare function initApiFetch($fetch: Fetch, config: FetchConfig): {
|
|
|
16
16
|
}) => Promise<import("./types").GetUserResponse | {
|
|
17
17
|
key: string;
|
|
18
18
|
}>;
|
|
19
|
+
signInByCodeSendCode: (body: {
|
|
20
|
+
username: string;
|
|
21
|
+
}) => Promise<{
|
|
22
|
+
key: string;
|
|
23
|
+
}>;
|
|
24
|
+
signInByCodeVerifyCode: (body: {
|
|
25
|
+
key: string;
|
|
26
|
+
code: string;
|
|
27
|
+
rememberMe?: boolean;
|
|
28
|
+
}) => Promise<import("./types").GetUserResponse>;
|
|
19
29
|
logout: () => Promise<void>;
|
|
20
30
|
fetchActiveSessions: () => Promise<{
|
|
21
31
|
sessions: import("./types").ActiveSession[];
|
|
@@ -77,6 +87,16 @@ export declare const useUserActions: () => Ref<{
|
|
|
77
87
|
}) => Promise<import("./types").GetUserResponse | {
|
|
78
88
|
key: string;
|
|
79
89
|
}>;
|
|
90
|
+
signInByCodeSendCode: (body: {
|
|
91
|
+
username: string;
|
|
92
|
+
}) => Promise<{
|
|
93
|
+
key: string;
|
|
94
|
+
}>;
|
|
95
|
+
signInByCodeVerifyCode: (body: {
|
|
96
|
+
key: string;
|
|
97
|
+
code: string;
|
|
98
|
+
rememberMe?: boolean;
|
|
99
|
+
}) => Promise<import("./types").GetUserResponse>;
|
|
80
100
|
logout: () => Promise<void>;
|
|
81
101
|
fetchActiveSessions: () => Promise<{
|
|
82
102
|
sessions: import("./types").ActiveSession[];
|
|
@@ -136,6 +156,16 @@ export declare const useUserActions: () => Ref<{
|
|
|
136
156
|
}) => Promise<import("./types").GetUserResponse | {
|
|
137
157
|
key: string;
|
|
138
158
|
}>;
|
|
159
|
+
signInByCodeSendCode: (body: {
|
|
160
|
+
username: string;
|
|
161
|
+
}) => Promise<{
|
|
162
|
+
key: string;
|
|
163
|
+
}>;
|
|
164
|
+
signInByCodeVerifyCode: (body: {
|
|
165
|
+
key: string;
|
|
166
|
+
code: string;
|
|
167
|
+
rememberMe?: boolean;
|
|
168
|
+
}) => Promise<import("./types").GetUserResponse>;
|
|
139
169
|
logout: () => Promise<void>;
|
|
140
170
|
fetchActiveSessions: () => Promise<{
|
|
141
171
|
sessions: import("./types").ActiveSession[];
|
|
@@ -8,6 +8,16 @@ export declare const createApiUserActions: (fetch: Fetch, config: FetchConfig, g
|
|
|
8
8
|
}) => Promise<GetUserResponse | {
|
|
9
9
|
key: string;
|
|
10
10
|
}>;
|
|
11
|
+
signInByCodeSendCode: (body: {
|
|
12
|
+
username: string;
|
|
13
|
+
}) => Promise<{
|
|
14
|
+
key: string;
|
|
15
|
+
}>;
|
|
16
|
+
signInByCodeVerifyCode: (body: {
|
|
17
|
+
key: string;
|
|
18
|
+
code: string;
|
|
19
|
+
rememberMe?: boolean;
|
|
20
|
+
}) => Promise<GetUserResponse>;
|
|
11
21
|
logout: () => Promise<void>;
|
|
12
22
|
fetchActiveSessions: () => Promise<{
|
|
13
23
|
sessions: ActiveSession[];
|
|
@@ -20,6 +20,26 @@ export const createApiUserActions = once(
|
|
|
20
20
|
setToken(accessToken);
|
|
21
21
|
return await getUser();
|
|
22
22
|
},
|
|
23
|
+
signInByCodeSendCode: async (body) => {
|
|
24
|
+
return await fetch("/account/0/signinbycode/sendcode", {
|
|
25
|
+
body,
|
|
26
|
+
method: "POST",
|
|
27
|
+
...config.useRequestHeaders?.(["cookie"]) ?? {}
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
signInByCodeVerifyCode: async (body) => {
|
|
31
|
+
const response = await fetch("/account/0/signinbycode/verifycode", {
|
|
32
|
+
body,
|
|
33
|
+
method: "POST",
|
|
34
|
+
...config.useRequestHeaders?.(["cookie"]) ?? {}
|
|
35
|
+
});
|
|
36
|
+
const { accessToken, ...rest } = response;
|
|
37
|
+
if (!accessToken) {
|
|
38
|
+
throw rest;
|
|
39
|
+
}
|
|
40
|
+
setToken(accessToken);
|
|
41
|
+
return await getUser();
|
|
42
|
+
},
|
|
23
43
|
logout: async () => {
|
|
24
44
|
const user = useUser();
|
|
25
45
|
try {
|