@inzombieland/nuxt-common 1.18.29 → 1.18.30
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 +0 -10
- package/dist/runtime/api/user-actions.d.ts +10 -10
- package/dist/runtime/api/user-actions.mjs +24 -4
- package/dist/runtime/packages/core/index.d.ts +0 -30
- package/dist/runtime/packages/core/package.json +1 -1
- package/dist/runtime/packages/core/user-actions.d.ts +0 -10
- package/dist/runtime/packages/core/user-actions.mjs +0 -20
- 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.30";
|
|
6
6
|
|
|
7
7
|
const module = defineNuxtModule({
|
|
8
8
|
meta: {
|
|
@@ -24,16 +24,6 @@ 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>;
|
|
37
27
|
logout: () => Promise<void>;
|
|
38
28
|
fetchActiveSessions: () => Promise<{
|
|
39
29
|
sessions: import("src/runtime/packages/core/types").ActiveSession[];
|
|
@@ -6,16 +6,6 @@ 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>;
|
|
19
9
|
export declare const logout: () => Promise<void>;
|
|
20
10
|
export declare const changeName: (body: {
|
|
21
11
|
firstName: string;
|
|
@@ -58,6 +48,16 @@ export declare const changePhone: (body: {
|
|
|
58
48
|
}) => Promise<void>;
|
|
59
49
|
export declare const changeAvatar: (body: FormData) => Promise<void>;
|
|
60
50
|
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,9 +1,7 @@
|
|
|
1
1
|
import { useRequestHeaders } from "#imports";
|
|
2
|
-
import { flush } from "../packages/core/api-client.mjs";
|
|
3
|
-
import { fetch, userActions } from "./index.mjs";
|
|
2
|
+
import { flush, setToken } from "../packages/core/api-client.mjs";
|
|
3
|
+
import { fetch, getUser, userActions } from "./index.mjs";
|
|
4
4
|
export const signIn = userActions.signIn;
|
|
5
|
-
export const signInByCodeSendCode = userActions.signInByCodeSendCode;
|
|
6
|
-
export const signInByCodeVerifyCode = userActions.signInByCodeVerifyCode;
|
|
7
5
|
export const logout = userActions.logout;
|
|
8
6
|
export const changeName = userActions.changeName;
|
|
9
7
|
export const changeBirthday = userActions.changeBirthday;
|
|
@@ -15,6 +13,28 @@ export const confirmEmailChange = userActions.confirmEmailChange;
|
|
|
15
13
|
export const changePhone = userActions.changePhone;
|
|
16
14
|
export const changeAvatar = userActions.changeAvatar;
|
|
17
15
|
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
|
+
};
|
|
18
38
|
export const signUp = async (body) => {
|
|
19
39
|
return await fetch("/account/0/signup", {
|
|
20
40
|
body,
|
|
@@ -16,16 +16,6 @@ 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>;
|
|
29
19
|
logout: () => Promise<void>;
|
|
30
20
|
fetchActiveSessions: () => Promise<{
|
|
31
21
|
sessions: import("./types").ActiveSession[];
|
|
@@ -87,16 +77,6 @@ export declare const useUserActions: () => Ref<{
|
|
|
87
77
|
}) => Promise<import("./types").GetUserResponse | {
|
|
88
78
|
key: string;
|
|
89
79
|
}>;
|
|
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>;
|
|
100
80
|
logout: () => Promise<void>;
|
|
101
81
|
fetchActiveSessions: () => Promise<{
|
|
102
82
|
sessions: import("./types").ActiveSession[];
|
|
@@ -156,16 +136,6 @@ export declare const useUserActions: () => Ref<{
|
|
|
156
136
|
}) => Promise<import("./types").GetUserResponse | {
|
|
157
137
|
key: string;
|
|
158
138
|
}>;
|
|
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>;
|
|
169
139
|
logout: () => Promise<void>;
|
|
170
140
|
fetchActiveSessions: () => Promise<{
|
|
171
141
|
sessions: import("./types").ActiveSession[];
|
|
@@ -8,16 +8,6 @@ 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>;
|
|
21
11
|
logout: () => Promise<void>;
|
|
22
12
|
fetchActiveSessions: () => Promise<{
|
|
23
13
|
sessions: ActiveSession[];
|
|
@@ -20,26 +20,6 @@ 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
|
-
},
|
|
43
23
|
logout: async () => {
|
|
44
24
|
const user = useUser();
|
|
45
25
|
try {
|