@inzombieland/nuxt-common 1.20.3 → 1.20.4
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/composables/use-user-actions.d.ts +2 -5
- package/dist/runtime/packages/core/index.d.ts +6 -15
- package/dist/runtime/packages/core/package.json +1 -1
- package/dist/runtime/packages/core/user-actions.d.ts +2 -5
- package/dist/runtime/packages/core/user-actions.js +6 -17
- package/dist/runtime/server/api/index.d.ts +2 -5
- 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.20.
|
|
5
|
+
const version = "1.20.4";
|
|
6
6
|
|
|
7
7
|
const module$1 = defineNuxtModule({
|
|
8
8
|
meta: {
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
export declare const useUserActions: () => {
|
|
2
|
-
signIn: (body: Record<string, any>) => Promise<
|
|
2
|
+
signIn: (body: Record<string, any>) => Promise<{
|
|
3
3
|
key: string;
|
|
4
4
|
}>;
|
|
5
|
-
|
|
6
|
-
key: string;
|
|
7
|
-
}>;
|
|
8
|
-
signInByCodeVerifyCode: (body: Record<string, any>) => Promise<import("../packages/core/index.js").GetUserResponse>;
|
|
5
|
+
signInVerifyCode: (body: Record<string, any>) => Promise<import("../packages/core/index.js").GetUserResponse>;
|
|
9
6
|
getToken: (body: Record<string, any>) => Promise<import("../packages/core/index.js").GetUserResponse>;
|
|
10
7
|
signUp: (body: Record<string, any>) => Promise<{
|
|
11
8
|
key: string;
|
|
@@ -9,13 +9,10 @@ export declare function initApiFetch($fetch: Fetch, config: FetchConfig): {
|
|
|
9
9
|
getUser: () => Promise<import("./types.js").GetUserResponse>;
|
|
10
10
|
useApiFetch: () => Fetch;
|
|
11
11
|
userActions: {
|
|
12
|
-
signIn: (body: Record<string, any>) => Promise<
|
|
12
|
+
signIn: (body: Record<string, any>) => Promise<{
|
|
13
13
|
key: string;
|
|
14
14
|
}>;
|
|
15
|
-
|
|
16
|
-
key: string;
|
|
17
|
-
}>;
|
|
18
|
-
signInByCodeVerifyCode: (body: Record<string, any>) => Promise<import("./types.js").GetUserResponse>;
|
|
15
|
+
signInVerifyCode: (body: Record<string, any>) => Promise<import("./types.js").GetUserResponse>;
|
|
19
16
|
getToken: (body: Record<string, any>) => Promise<import("./types.js").GetUserResponse>;
|
|
20
17
|
signUp: (body: Record<string, any>) => Promise<{
|
|
21
18
|
key: string;
|
|
@@ -108,13 +105,10 @@ export declare function initApiFetch($fetch: Fetch, config: FetchConfig): {
|
|
|
108
105
|
};
|
|
109
106
|
};
|
|
110
107
|
export declare const useUserActions: () => Ref<{
|
|
111
|
-
signIn: (body: Record<string, any>) => Promise<
|
|
112
|
-
key: string;
|
|
113
|
-
}>;
|
|
114
|
-
signInByCodeSendCode: (body: Record<string, any>) => Promise<{
|
|
108
|
+
signIn: (body: Record<string, any>) => Promise<{
|
|
115
109
|
key: string;
|
|
116
110
|
}>;
|
|
117
|
-
|
|
111
|
+
signInVerifyCode: (body: Record<string, any>) => Promise<import("./types.js").GetUserResponse>;
|
|
118
112
|
getToken: (body: Record<string, any>) => Promise<import("./types.js").GetUserResponse>;
|
|
119
113
|
signUp: (body: Record<string, any>) => Promise<{
|
|
120
114
|
key: string;
|
|
@@ -205,13 +199,10 @@ export declare const useUserActions: () => Ref<{
|
|
|
205
199
|
code: string;
|
|
206
200
|
}) => Promise<void>;
|
|
207
201
|
}, {
|
|
208
|
-
signIn: (body: Record<string, any>) => Promise<
|
|
209
|
-
key: string;
|
|
210
|
-
}>;
|
|
211
|
-
signInByCodeSendCode: (body: Record<string, any>) => Promise<{
|
|
202
|
+
signIn: (body: Record<string, any>) => Promise<{
|
|
212
203
|
key: string;
|
|
213
204
|
}>;
|
|
214
|
-
|
|
205
|
+
signInVerifyCode: (body: Record<string, any>) => Promise<import("./types.js").GetUserResponse>;
|
|
215
206
|
getToken: (body: Record<string, any>) => Promise<import("./types.js").GetUserResponse>;
|
|
216
207
|
signUp: (body: Record<string, any>) => Promise<{
|
|
217
208
|
key: string;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import type { ActiveSession, Fetch, FetchConfig, GetUserResponse } from "./types.js";
|
|
2
2
|
export type UserActions = ReturnType<typeof createApiUserActions>;
|
|
3
3
|
export declare const createApiUserActions: (fetch: Fetch, config: FetchConfig, getUser: () => Promise<GetUserResponse>) => {
|
|
4
|
-
signIn: (body: Record<string, any>) => Promise<
|
|
4
|
+
signIn: (body: Record<string, any>) => Promise<{
|
|
5
5
|
key: string;
|
|
6
6
|
}>;
|
|
7
|
-
|
|
8
|
-
key: string;
|
|
9
|
-
}>;
|
|
10
|
-
signInByCodeVerifyCode: (body: Record<string, any>) => Promise<GetUserResponse>;
|
|
7
|
+
signInVerifyCode: (body: Record<string, any>) => Promise<GetUserResponse>;
|
|
11
8
|
getToken: (body: Record<string, any>) => Promise<GetUserResponse>;
|
|
12
9
|
signUp: (body: Record<string, any>) => Promise<{
|
|
13
10
|
key: string;
|
|
@@ -11,31 +11,20 @@ export const createApiUserActions = once(
|
|
|
11
11
|
method: "POST",
|
|
12
12
|
...config.useRequestHeaders?.(["cookie"]) ?? {}
|
|
13
13
|
});
|
|
14
|
-
const {
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
return { key };
|
|
18
|
-
}
|
|
19
|
-
throw rest;
|
|
14
|
+
const { key, ...rest } = response;
|
|
15
|
+
if (key) {
|
|
16
|
+
return { key };
|
|
20
17
|
}
|
|
21
|
-
|
|
22
|
-
return await getUser();
|
|
23
|
-
},
|
|
24
|
-
signInByCodeSendCode: async (body) => {
|
|
25
|
-
return await fetch("/account/0/signinbycode/sendcode", {
|
|
26
|
-
body,
|
|
27
|
-
method: "POST",
|
|
28
|
-
...config.useRequestHeaders?.(["cookie"]) ?? {}
|
|
29
|
-
});
|
|
18
|
+
throw rest;
|
|
30
19
|
},
|
|
31
|
-
|
|
20
|
+
signInVerifyCode: async (body) => {
|
|
32
21
|
const response = await fetch("/account/0/signinbycode/verifycode", {
|
|
33
22
|
body,
|
|
34
23
|
method: "POST",
|
|
35
24
|
...config.useRequestHeaders?.(["cookie"]) ?? {}
|
|
36
25
|
});
|
|
37
26
|
const { accessToken, sessionId, visitorId, secretKey, ...rest } = response;
|
|
38
|
-
if (!accessToken || !sessionId) {
|
|
27
|
+
if (!accessToken || !sessionId || !visitorId || !secretKey) {
|
|
39
28
|
throw rest;
|
|
40
29
|
}
|
|
41
30
|
setToken(accessToken);
|
|
@@ -17,13 +17,10 @@ export declare const config: {
|
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
declare const fetch: Fetch, getUser: () => Promise<import("../../packages/core/index.js").GetUserResponse>, useApiFetch: () => Fetch, userActions: {
|
|
20
|
-
signIn: (body: Record<string, any>) => Promise<
|
|
20
|
+
signIn: (body: Record<string, any>) => Promise<{
|
|
21
21
|
key: string;
|
|
22
22
|
}>;
|
|
23
|
-
|
|
24
|
-
key: string;
|
|
25
|
-
}>;
|
|
26
|
-
signInByCodeVerifyCode: (body: Record<string, any>) => Promise<import("../../packages/core/index.js").GetUserResponse>;
|
|
23
|
+
signInVerifyCode: (body: Record<string, any>) => Promise<import("../../packages/core/index.js").GetUserResponse>;
|
|
27
24
|
getToken: (body: Record<string, any>) => Promise<import("../../packages/core/index.js").GetUserResponse>;
|
|
28
25
|
signUp: (body: Record<string, any>) => Promise<{
|
|
29
26
|
key: string;
|