@inzombieland/core 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/index.d.ts CHANGED
@@ -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
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inzombieland/core",
3
- "version": "1.19.12",
3
+ "version": "1.19.13",
4
4
  "type": "module",
5
5
  "license": "ISC",
6
6
  "main": "./index.mjs",
package/user-actions.d.ts CHANGED
@@ -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
  }>;
package/user-actions.mjs CHANGED
@@ -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,