@inzombieland/core 1.18.27 → 1.18.29
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 +30 -0
- package/init-application.mjs +2 -2
- package/package.json +1 -1
- package/user-actions.d.ts +10 -0
- package/user-actions.mjs +20 -0
package/index.d.ts
CHANGED
|
@@ -16,6 +16,16 @@ export declare function initApiFetch($fetch: Fetch, config: FetchConfig): {
|
|
|
16
16
|
}) => Promise<import("./types").GetUserResponse | {
|
|
17
17
|
key: string;
|
|
18
18
|
}>;
|
|
19
|
+
signInByCodeSendCode: (body: {
|
|
20
|
+
username: string;
|
|
21
|
+
}) => Promise<{
|
|
22
|
+
key: string;
|
|
23
|
+
}>;
|
|
24
|
+
signInByCodeVerifyCode: (body: {
|
|
25
|
+
key: string;
|
|
26
|
+
code: string;
|
|
27
|
+
rememberMe?: boolean;
|
|
28
|
+
}) => Promise<import("./types").GetUserResponse>;
|
|
19
29
|
logout: () => Promise<void>;
|
|
20
30
|
fetchActiveSessions: () => Promise<{
|
|
21
31
|
sessions: import("./types").ActiveSession[];
|
|
@@ -77,6 +87,16 @@ export declare const useUserActions: () => Ref<{
|
|
|
77
87
|
}) => Promise<import("./types").GetUserResponse | {
|
|
78
88
|
key: string;
|
|
79
89
|
}>;
|
|
90
|
+
signInByCodeSendCode: (body: {
|
|
91
|
+
username: string;
|
|
92
|
+
}) => Promise<{
|
|
93
|
+
key: string;
|
|
94
|
+
}>;
|
|
95
|
+
signInByCodeVerifyCode: (body: {
|
|
96
|
+
key: string;
|
|
97
|
+
code: string;
|
|
98
|
+
rememberMe?: boolean;
|
|
99
|
+
}) => Promise<import("./types").GetUserResponse>;
|
|
80
100
|
logout: () => Promise<void>;
|
|
81
101
|
fetchActiveSessions: () => Promise<{
|
|
82
102
|
sessions: import("./types").ActiveSession[];
|
|
@@ -136,6 +156,16 @@ export declare const useUserActions: () => Ref<{
|
|
|
136
156
|
}) => Promise<import("./types").GetUserResponse | {
|
|
137
157
|
key: string;
|
|
138
158
|
}>;
|
|
159
|
+
signInByCodeSendCode: (body: {
|
|
160
|
+
username: string;
|
|
161
|
+
}) => Promise<{
|
|
162
|
+
key: string;
|
|
163
|
+
}>;
|
|
164
|
+
signInByCodeVerifyCode: (body: {
|
|
165
|
+
key: string;
|
|
166
|
+
code: string;
|
|
167
|
+
rememberMe?: boolean;
|
|
168
|
+
}) => Promise<import("./types").GetUserResponse>;
|
|
139
169
|
logout: () => Promise<void>;
|
|
140
170
|
fetchActiveSessions: () => Promise<{
|
|
141
171
|
sessions: import("./types").ActiveSession[];
|
package/init-application.mjs
CHANGED
|
@@ -55,11 +55,11 @@ function initApplication() {
|
|
|
55
55
|
i18n.setLocale(locale2?.value);
|
|
56
56
|
}
|
|
57
57
|
if (locale2?.value === "en") {
|
|
58
|
-
VantLocale.use(
|
|
58
|
+
VantLocale.use("en-US", enUS);
|
|
59
59
|
VarletLocale.add("en-US", VarletLocale.enUS);
|
|
60
60
|
}
|
|
61
61
|
if (locale2?.value === "ru") {
|
|
62
|
-
VantLocale.use(
|
|
62
|
+
VantLocale.use("ru-RU", ruRU);
|
|
63
63
|
VarletLocale.add("en-US", VarletLocale.enUS);
|
|
64
64
|
}
|
|
65
65
|
const localeCookie = useCookies("locale", { maxAge: 60 * 60 * 24 * 365 });
|
package/package.json
CHANGED
package/user-actions.d.ts
CHANGED
|
@@ -8,6 +8,16 @@ export declare const createApiUserActions: (fetch: Fetch, config: FetchConfig, g
|
|
|
8
8
|
}) => Promise<GetUserResponse | {
|
|
9
9
|
key: string;
|
|
10
10
|
}>;
|
|
11
|
+
signInByCodeSendCode: (body: {
|
|
12
|
+
username: string;
|
|
13
|
+
}) => Promise<{
|
|
14
|
+
key: string;
|
|
15
|
+
}>;
|
|
16
|
+
signInByCodeVerifyCode: (body: {
|
|
17
|
+
key: string;
|
|
18
|
+
code: string;
|
|
19
|
+
rememberMe?: boolean;
|
|
20
|
+
}) => Promise<GetUserResponse>;
|
|
11
21
|
logout: () => Promise<void>;
|
|
12
22
|
fetchActiveSessions: () => Promise<{
|
|
13
23
|
sessions: ActiveSession[];
|
package/user-actions.mjs
CHANGED
|
@@ -20,6 +20,26 @@ export const createApiUserActions = once(
|
|
|
20
20
|
setToken(accessToken);
|
|
21
21
|
return await getUser();
|
|
22
22
|
},
|
|
23
|
+
signInByCodeSendCode: async (body) => {
|
|
24
|
+
return await fetch("/account/0/signinbycode/sendcode", {
|
|
25
|
+
body,
|
|
26
|
+
method: "POST",
|
|
27
|
+
...config.useRequestHeaders?.(["cookie"]) ?? {}
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
signInByCodeVerifyCode: async (body) => {
|
|
31
|
+
const response = await fetch("/account/0/signinbycode/verifycode", {
|
|
32
|
+
body,
|
|
33
|
+
method: "POST",
|
|
34
|
+
...config.useRequestHeaders?.(["cookie"]) ?? {}
|
|
35
|
+
});
|
|
36
|
+
const { accessToken, ...rest } = response;
|
|
37
|
+
if (!accessToken) {
|
|
38
|
+
throw rest;
|
|
39
|
+
}
|
|
40
|
+
setToken(accessToken);
|
|
41
|
+
return await getUser();
|
|
42
|
+
},
|
|
23
43
|
logout: async () => {
|
|
24
44
|
const user = useUser();
|
|
25
45
|
try {
|