@inzombieland/core 1.18.30 → 1.18.31

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
@@ -9,13 +9,10 @@ export declare function initApiFetch($fetch: Fetch, config: FetchConfig): {
9
9
  getUser: () => Promise<import("./types").GetUserResponse>;
10
10
  useApiFetch: () => Fetch;
11
11
  userActions: {
12
- signIn: (body: {
13
- username: string;
14
- password: string;
15
- rememberMe: boolean;
16
- }) => Promise<import("./types").GetUserResponse | {
12
+ signIn: (body: Record<string, any>) => Promise<import("./types").GetUserResponse | {
17
13
  key: string;
18
14
  }>;
15
+ signInByCodeVerifyCode: (body: Record<string, any>) => Promise<import("./types").GetUserResponse>;
19
16
  logout: () => Promise<void>;
20
17
  fetchActiveSessions: () => Promise<{
21
18
  sessions: import("./types").ActiveSession[];
@@ -70,13 +67,10 @@ export declare function initApiFetch($fetch: Fetch, config: FetchConfig): {
70
67
  };
71
68
  };
72
69
  export declare const useUserActions: () => Ref<{
73
- signIn: (body: {
74
- username: string;
75
- password: string;
76
- rememberMe: boolean;
77
- }) => Promise<import("./types").GetUserResponse | {
70
+ signIn: (body: Record<string, any>) => Promise<import("./types").GetUserResponse | {
78
71
  key: string;
79
72
  }>;
73
+ signInByCodeVerifyCode: (body: Record<string, any>) => Promise<import("./types").GetUserResponse>;
80
74
  logout: () => Promise<void>;
81
75
  fetchActiveSessions: () => Promise<{
82
76
  sessions: import("./types").ActiveSession[];
@@ -129,13 +123,10 @@ export declare const useUserActions: () => Ref<{
129
123
  changeAvatar: (body: FormData) => Promise<void>;
130
124
  deleteAvatar: () => Promise<void>;
131
125
  }, {
132
- signIn: (body: {
133
- username: string;
134
- password: string;
135
- rememberMe: boolean;
136
- }) => Promise<import("./types").GetUserResponse | {
126
+ signIn: (body: Record<string, any>) => Promise<import("./types").GetUserResponse | {
137
127
  key: string;
138
128
  }>;
129
+ signInByCodeVerifyCode: (body: Record<string, any>) => Promise<import("./types").GetUserResponse>;
139
130
  logout: () => Promise<void>;
140
131
  fetchActiveSessions: () => Promise<{
141
132
  sessions: import("./types").ActiveSession[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inzombieland/core",
3
- "version": "1.18.30",
3
+ "version": "1.18.31",
4
4
  "type": "module",
5
5
  "license": "ISC",
6
6
  "main": "./index.mjs",
package/user-actions.d.ts CHANGED
@@ -1,13 +1,10 @@
1
1
  import type { ActiveSession, Fetch, FetchConfig, GetUserResponse } from "./types";
2
2
  export type UserActions = ReturnType<typeof createApiUserActions>;
3
3
  export declare const createApiUserActions: (fetch: Fetch, config: FetchConfig, getUser: () => Promise<GetUserResponse>) => {
4
- signIn: (body: {
5
- username: string;
6
- password: string;
7
- rememberMe: boolean;
8
- }) => Promise<GetUserResponse | {
4
+ signIn: (body: Record<string, any>) => Promise<GetUserResponse | {
9
5
  key: string;
10
6
  }>;
7
+ signInByCodeVerifyCode: (body: Record<string, any>) => Promise<GetUserResponse>;
11
8
  logout: () => Promise<void>;
12
9
  fetchActiveSessions: () => Promise<{
13
10
  sessions: ActiveSession[];
package/user-actions.mjs CHANGED
@@ -20,6 +20,19 @@ export const createApiUserActions = once(
20
20
  setToken(accessToken);
21
21
  return await getUser();
22
22
  },
23
+ signInByCodeVerifyCode: async (body) => {
24
+ const response = await fetch("/account/0/signinbycode/verifycode", {
25
+ body,
26
+ method: "POST",
27
+ ...config.useRequestHeaders?.(["cookie"]) ?? {}
28
+ });
29
+ const { accessToken, ...rest } = response;
30
+ if (!accessToken) {
31
+ throw rest;
32
+ }
33
+ setToken(accessToken);
34
+ return await getUser();
35
+ },
23
36
  logout: async () => {
24
37
  const user = useUser();
25
38
  try {