@inzombieland/nuxt-common 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/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inzombieland/nuxt-common",
3
- "version": "1.18.30",
3
+ "version": "1.18.31",
4
4
  "configKey": "nuxt-common",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.6.0",
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.30";
5
+ const version = "1.18.31";
6
6
 
7
7
  const module = defineNuxtModule({
8
8
  meta: {
@@ -17,13 +17,10 @@ export declare const config: {
17
17
  };
18
18
  };
19
19
  declare const fetch: Fetch, getUser: () => Promise<import("src/runtime/packages/core/types").GetUserResponse>, useApiFetch: () => Fetch, userActions: {
20
- signIn: (body: {
21
- username: string;
22
- password: string;
23
- rememberMe: boolean;
24
- }) => Promise<import("src/runtime/packages/core/types").GetUserResponse | {
20
+ signIn: (body: Record<string, any>) => Promise<import("src/runtime/packages/core/types").GetUserResponse | {
25
21
  key: string;
26
22
  }>;
23
+ signInByCodeVerifyCode: (body: Record<string, any>) => Promise<import("src/runtime/packages/core/types").GetUserResponse>;
27
24
  logout: () => Promise<void>;
28
25
  fetchActiveSessions: () => Promise<{
29
26
  sessions: import("src/runtime/packages/core/types").ActiveSession[];
@@ -1,11 +1,8 @@
1
1
  import type { ActiveSession } from "../packages/core";
2
- export declare const signIn: (body: {
3
- username: string;
4
- password: string;
5
- rememberMe: boolean;
6
- }) => Promise<import("src/runtime/packages/core/types").GetUserResponse | {
2
+ export declare const signIn: (body: Record<string, any>) => Promise<import("src/runtime/packages/core/types").GetUserResponse | {
7
3
  key: string;
8
4
  }>;
5
+ export declare const signInByCodeVerifyCode: (body: Record<string, any>) => Promise<import("src/runtime/packages/core/types").GetUserResponse>;
9
6
  export declare const logout: () => Promise<void>;
10
7
  export declare const changeName: (body: {
11
8
  firstName: string;
@@ -53,11 +50,6 @@ export declare const signInByCodeSendCode: (body: {
53
50
  }) => Promise<{
54
51
  key: string;
55
52
  }>;
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
53
  export declare const signUp: (body: {
62
54
  email: string;
63
55
  password: string;
@@ -1,7 +1,8 @@
1
1
  import { useRequestHeaders } from "#imports";
2
- import { flush, setToken } from "../packages/core/api-client.mjs";
3
- import { fetch, getUser, userActions } from "./index.mjs";
2
+ import { flush } from "../packages/core/api-client.mjs";
3
+ import { fetch, userActions } from "./index.mjs";
4
4
  export const signIn = userActions.signIn;
5
+ export const signInByCodeVerifyCode = userActions.signInByCodeVerifyCode;
5
6
  export const logout = userActions.logout;
6
7
  export const changeName = userActions.changeName;
7
8
  export const changeBirthday = userActions.changeBirthday;
@@ -21,20 +22,6 @@ export const signInByCodeSendCode = async (body) => {
21
22
  headers: useRequestHeaders(["cookie"])
22
23
  });
23
24
  };
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
- };
38
25
  export const signUp = async (body) => {
39
26
  return await fetch("/account/0/signup", {
40
27
  body,
@@ -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[];
@@ -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",
@@ -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[];
@@ -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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inzombieland/nuxt-common",
3
- "version": "1.18.30",
3
+ "version": "1.18.31",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "exports": {