@inzombieland/nuxt-common 1.19.12 → 1.19.13
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 +1 -0
- package/dist/runtime/composables/use-user-actions.d.ts +1 -0
- package/dist/runtime/packages/core/index.d.ts +3 -0
- package/dist/runtime/packages/core/package.json +1 -1
- package/dist/runtime/packages/core/user-actions.d.ts +1 -0
- package/dist/runtime/packages/core/user-actions.mjs +13 -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.19.
|
|
5
|
+
const version = "1.19.13";
|
|
6
6
|
|
|
7
7
|
const module = defineNuxtModule({
|
|
8
8
|
meta: {
|
|
@@ -24,6 +24,7 @@ declare const fetch: Fetch, getUser: () => Promise<import("src/runtime/packages/
|
|
|
24
24
|
key: string;
|
|
25
25
|
}>;
|
|
26
26
|
signInByCodeVerifyCode: (body: Record<string, any>) => Promise<import("src/runtime/packages/core/types").GetUserResponse>;
|
|
27
|
+
getToken: (body: Record<string, any>) => Promise<import("src/runtime/packages/core/types").GetUserResponse>;
|
|
27
28
|
signUp: (body: Record<string, any>) => Promise<{
|
|
28
29
|
key: string;
|
|
29
30
|
}>;
|
|
@@ -6,6 +6,7 @@ export declare const useUserActions: () => {
|
|
|
6
6
|
key: string;
|
|
7
7
|
}>;
|
|
8
8
|
signInByCodeVerifyCode: (body: Record<string, any>) => Promise<import("src/runtime/packages/core").GetUserResponse>;
|
|
9
|
+
getToken: (body: Record<string, any>) => Promise<import("src/runtime/packages/core").GetUserResponse>;
|
|
9
10
|
signUp: (body: Record<string, any>) => Promise<{
|
|
10
11
|
key: string;
|
|
11
12
|
}>;
|
|
@@ -16,6 +16,7 @@ export declare function initApiFetch($fetch: Fetch, config: FetchConfig): {
|
|
|
16
16
|
key: string;
|
|
17
17
|
}>;
|
|
18
18
|
signInByCodeVerifyCode: (body: Record<string, any>) => Promise<import("./types").GetUserResponse>;
|
|
19
|
+
getToken: (body: Record<string, any>) => Promise<import("./types").GetUserResponse>;
|
|
19
20
|
signUp: (body: Record<string, any>) => Promise<{
|
|
20
21
|
key: string;
|
|
21
22
|
}>;
|
|
@@ -114,6 +115,7 @@ export declare const useUserActions: () => Ref<{
|
|
|
114
115
|
key: string;
|
|
115
116
|
}>;
|
|
116
117
|
signInByCodeVerifyCode: (body: Record<string, any>) => Promise<import("./types").GetUserResponse>;
|
|
118
|
+
getToken: (body: Record<string, any>) => Promise<import("./types").GetUserResponse>;
|
|
117
119
|
signUp: (body: Record<string, any>) => Promise<{
|
|
118
120
|
key: string;
|
|
119
121
|
}>;
|
|
@@ -210,6 +212,7 @@ export declare const useUserActions: () => Ref<{
|
|
|
210
212
|
key: string;
|
|
211
213
|
}>;
|
|
212
214
|
signInByCodeVerifyCode: (body: Record<string, any>) => Promise<import("./types").GetUserResponse>;
|
|
215
|
+
getToken: (body: Record<string, any>) => Promise<import("./types").GetUserResponse>;
|
|
213
216
|
signUp: (body: Record<string, any>) => Promise<{
|
|
214
217
|
key: string;
|
|
215
218
|
}>;
|
|
@@ -8,6 +8,7 @@ export declare const createApiUserActions: (fetch: Fetch, config: FetchConfig, g
|
|
|
8
8
|
key: string;
|
|
9
9
|
}>;
|
|
10
10
|
signInByCodeVerifyCode: (body: Record<string, any>) => Promise<GetUserResponse>;
|
|
11
|
+
getToken: (body: Record<string, any>) => Promise<GetUserResponse>;
|
|
11
12
|
signUp: (body: Record<string, any>) => Promise<{
|
|
12
13
|
key: string;
|
|
13
14
|
}>;
|
|
@@ -44,6 +44,19 @@ export const createApiUserActions = once(
|
|
|
44
44
|
setSecretKey(secretKey);
|
|
45
45
|
return await getUser();
|
|
46
46
|
},
|
|
47
|
+
getToken: async (body) => {
|
|
48
|
+
const response = await fetch("/account/0/token", {
|
|
49
|
+
body,
|
|
50
|
+
method: "POST",
|
|
51
|
+
...config.useRequestHeaders?.(["cookie"]) ?? {}
|
|
52
|
+
});
|
|
53
|
+
const { accessToken, ...rest } = response;
|
|
54
|
+
if (!accessToken) {
|
|
55
|
+
throw rest;
|
|
56
|
+
}
|
|
57
|
+
setToken(accessToken);
|
|
58
|
+
return await getUser();
|
|
59
|
+
},
|
|
47
60
|
signUp: async (body) => {
|
|
48
61
|
return await fetch("/account/0/signup", {
|
|
49
62
|
body,
|