@inzombieland/nuxt-common 1.18.44 → 1.18.45
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 +25 -2
- package/dist/runtime/api/user-actions.d.ts +2 -94
- package/dist/runtime/api/user-actions.mjs +2 -63
- package/dist/runtime/composables/use-user-actions.d.ts +97 -2
- package/dist/runtime/composables/use-user-actions.mjs +1 -1
- package/dist/runtime/packages/core/AppProvider.vue +1 -3
- package/dist/runtime/packages/core/index.d.ts +75 -6
- package/dist/runtime/packages/core/package.json +1 -1
- package/dist/runtime/packages/core/user-actions.d.ts +25 -2
- package/dist/runtime/packages/core/user-actions.mjs +37 -2
- 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.18.
|
|
5
|
+
const version = "1.18.45";
|
|
6
6
|
|
|
7
7
|
const module = defineNuxtModule({
|
|
8
8
|
meta: {
|
|
@@ -20,6 +20,9 @@ declare const fetch: Fetch, getUser: () => Promise<import("src/runtime/packages/
|
|
|
20
20
|
signIn: (body: Record<string, any>) => Promise<import("src/runtime/packages/core/types").GetUserResponse | {
|
|
21
21
|
key: string;
|
|
22
22
|
}>;
|
|
23
|
+
signInByCodeSendCode: (body: Record<string, any>) => Promise<{
|
|
24
|
+
key: string;
|
|
25
|
+
}>;
|
|
23
26
|
signInByCodeVerifyCode: (body: Record<string, any>) => Promise<import("src/runtime/packages/core/types").GetUserResponse>;
|
|
24
27
|
signUp: (body: Record<string, any>) => Promise<{
|
|
25
28
|
key: string;
|
|
@@ -34,9 +37,19 @@ declare const fetch: Fetch, getUser: () => Promise<import("src/runtime/packages/
|
|
|
34
37
|
key: string;
|
|
35
38
|
}>;
|
|
36
39
|
logout: () => Promise<void>;
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
recovery: (body: Record<string, any>) => Promise<{
|
|
41
|
+
key: string;
|
|
39
42
|
}>;
|
|
43
|
+
confirmRecovery: (body: {
|
|
44
|
+
key: string;
|
|
45
|
+
code: string;
|
|
46
|
+
}) => Promise<{
|
|
47
|
+
key: string;
|
|
48
|
+
}>;
|
|
49
|
+
resetPassword: (body: {
|
|
50
|
+
key: string;
|
|
51
|
+
password: string;
|
|
52
|
+
}) => Promise<{}>;
|
|
40
53
|
changeName: (body: {
|
|
41
54
|
firstName: string;
|
|
42
55
|
lastName: string;
|
|
@@ -84,10 +97,20 @@ declare const fetch: Fetch, getUser: () => Promise<import("src/runtime/packages/
|
|
|
84
97
|
}) => Promise<void>;
|
|
85
98
|
changeAvatar: (body: FormData) => Promise<void>;
|
|
86
99
|
deleteAvatar: () => Promise<void>;
|
|
100
|
+
fetchActiveSessions: () => Promise<{
|
|
101
|
+
sessions: import("src/runtime/packages/core/types").ActiveSession[];
|
|
102
|
+
}>;
|
|
87
103
|
logoutActiveSession: (body: {
|
|
88
104
|
sessionId: string;
|
|
89
105
|
visitorId: string;
|
|
90
106
|
}) => Promise<any>;
|
|
91
107
|
logoutFromAllActiveSessions: () => Promise<any>;
|
|
108
|
+
deleteAccount: () => Promise<{
|
|
109
|
+
key: string;
|
|
110
|
+
}>;
|
|
111
|
+
confirmDeleteAccount: (body: {
|
|
112
|
+
key: string;
|
|
113
|
+
code: string;
|
|
114
|
+
}) => Promise<void>;
|
|
92
115
|
};
|
|
93
116
|
export { fetch, getUser, useApiFetch, userActions };
|
|
@@ -1,94 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export
|
|
3
|
-
key: string;
|
|
4
|
-
}>;
|
|
5
|
-
export declare const signInByCodeVerifyCode: (body: Record<string, any>) => Promise<import("src/runtime/packages/core/types").GetUserResponse>;
|
|
6
|
-
export declare const signUp: (body: Record<string, any>) => Promise<{
|
|
7
|
-
key: string;
|
|
8
|
-
}>;
|
|
9
|
-
export declare const confirmEmail: (body: {
|
|
10
|
-
key: string;
|
|
11
|
-
code: string;
|
|
12
|
-
}) => Promise<{}>;
|
|
13
|
-
export declare const resendActivationEmail: (body: {
|
|
14
|
-
email: string;
|
|
15
|
-
}) => Promise<{
|
|
16
|
-
key: string;
|
|
17
|
-
}>;
|
|
18
|
-
export declare const logout: () => Promise<void>;
|
|
19
|
-
export declare const changeName: (body: {
|
|
20
|
-
firstName: string;
|
|
21
|
-
lastName: string;
|
|
22
|
-
middleName: string;
|
|
23
|
-
}) => Promise<void>;
|
|
24
|
-
export declare const changeBirthday: (body: {
|
|
25
|
-
day?: number;
|
|
26
|
-
month?: number;
|
|
27
|
-
year?: number;
|
|
28
|
-
}) => Promise<void>;
|
|
29
|
-
export declare const changeGender: (body: {
|
|
30
|
-
gender: "" | "male" | "female";
|
|
31
|
-
}) => Promise<void>;
|
|
32
|
-
export declare const changePassword: (body: {
|
|
33
|
-
password: string;
|
|
34
|
-
newPassword: string;
|
|
35
|
-
}) => Promise<{
|
|
36
|
-
key: string;
|
|
37
|
-
}>;
|
|
38
|
-
export declare const confirmPasswordChange: (body: {
|
|
39
|
-
key: string;
|
|
40
|
-
code: string;
|
|
41
|
-
newPassword?: string;
|
|
42
|
-
}) => Promise<void>;
|
|
43
|
-
export declare const changeEmail: (body: {
|
|
44
|
-
email: string;
|
|
45
|
-
password: string;
|
|
46
|
-
}) => Promise<{
|
|
47
|
-
key: string;
|
|
48
|
-
}>;
|
|
49
|
-
export declare const confirmEmailChange: (body: {
|
|
50
|
-
key: string;
|
|
51
|
-
code: string;
|
|
52
|
-
email?: string;
|
|
53
|
-
}) => Promise<void>;
|
|
54
|
-
export declare const changePhone: (body: {
|
|
55
|
-
phone: string;
|
|
56
|
-
password: string;
|
|
57
|
-
}) => Promise<void>;
|
|
58
|
-
export declare const changeAvatar: (body: FormData) => Promise<void>;
|
|
59
|
-
export declare const deleteAvatar: () => Promise<void>;
|
|
60
|
-
export declare const logoutActiveSession: (body: {
|
|
61
|
-
sessionId: string;
|
|
62
|
-
visitorId: string;
|
|
63
|
-
}) => Promise<any>;
|
|
64
|
-
export declare const logoutFromAllActiveSessions: () => Promise<any>;
|
|
65
|
-
export declare const signInByCodeSendCode: (body: {
|
|
66
|
-
username: string;
|
|
67
|
-
}) => Promise<{
|
|
68
|
-
key: string;
|
|
69
|
-
}>;
|
|
70
|
-
export declare const recovery: (body: {
|
|
71
|
-
email: string;
|
|
72
|
-
}) => Promise<{
|
|
73
|
-
key: string;
|
|
74
|
-
}>;
|
|
75
|
-
export declare const confirmRecovery: (body: {
|
|
76
|
-
key: string;
|
|
77
|
-
code: string;
|
|
78
|
-
}) => Promise<{
|
|
79
|
-
key: string;
|
|
80
|
-
}>;
|
|
81
|
-
export declare const resetPassword: (body: {
|
|
82
|
-
key: string;
|
|
83
|
-
password: string;
|
|
84
|
-
}) => Promise<{}>;
|
|
85
|
-
export declare const fetchActiveSessions: () => Promise<{
|
|
86
|
-
sessions: ActiveSession[];
|
|
87
|
-
}>;
|
|
88
|
-
export declare const deleteAccount: () => Promise<{
|
|
89
|
-
key: string;
|
|
90
|
-
}>;
|
|
91
|
-
export declare const confirmDeleteAccount: (body: {
|
|
92
|
-
key: string;
|
|
93
|
-
code: string;
|
|
94
|
-
}) => Promise<void>;
|
|
1
|
+
import { userActions } from "./index";
|
|
2
|
+
export default userActions;
|
|
@@ -1,63 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { fetch, userActions } from "./index.mjs";
|
|
4
|
-
export const signIn = userActions.signIn;
|
|
5
|
-
export const signInByCodeVerifyCode = userActions.signInByCodeVerifyCode;
|
|
6
|
-
export const signUp = userActions.signUp;
|
|
7
|
-
export const confirmEmail = userActions.confirmEmail;
|
|
8
|
-
export const resendActivationEmail = userActions.resendActivationEmail;
|
|
9
|
-
export const logout = userActions.logout;
|
|
10
|
-
export const changeName = userActions.changeName;
|
|
11
|
-
export const changeBirthday = userActions.changeBirthday;
|
|
12
|
-
export const changeGender = userActions.changeGender;
|
|
13
|
-
export const changePassword = userActions.changePassword;
|
|
14
|
-
export const confirmPasswordChange = userActions.confirmPasswordChange;
|
|
15
|
-
export const changeEmail = userActions.changeEmail;
|
|
16
|
-
export const confirmEmailChange = userActions.confirmEmailChange;
|
|
17
|
-
export const changePhone = userActions.changePhone;
|
|
18
|
-
export const changeAvatar = userActions.changeAvatar;
|
|
19
|
-
export const deleteAvatar = userActions.deleteAvatar;
|
|
20
|
-
export const logoutActiveSession = userActions.logoutActiveSession;
|
|
21
|
-
export const logoutFromAllActiveSessions = userActions.logoutFromAllActiveSessions;
|
|
22
|
-
export const signInByCodeSendCode = async (body) => {
|
|
23
|
-
return await fetch("/account/0/signinbycode/sendcode", {
|
|
24
|
-
body,
|
|
25
|
-
method: "POST",
|
|
26
|
-
baseURL: "/",
|
|
27
|
-
headers: useRequestHeaders(["cookie"])
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
export const recovery = async (body) => {
|
|
31
|
-
return await fetch("/account/0/recovery", {
|
|
32
|
-
body,
|
|
33
|
-
method: "POST",
|
|
34
|
-
baseURL: "/",
|
|
35
|
-
headers: useRequestHeaders(["cookie"])
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
export const confirmRecovery = async (body) => {
|
|
39
|
-
return await fetch("/account/0/recovery", {
|
|
40
|
-
body,
|
|
41
|
-
method: "PATCH",
|
|
42
|
-
baseURL: "/",
|
|
43
|
-
headers: useRequestHeaders(["cookie"])
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
export const resetPassword = async (body) => {
|
|
47
|
-
return await fetch("/account/0/recovery", {
|
|
48
|
-
body,
|
|
49
|
-
method: "PUT",
|
|
50
|
-
baseURL: "/",
|
|
51
|
-
headers: useRequestHeaders(["cookie"])
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
export const fetchActiveSessions = async () => {
|
|
55
|
-
return await fetch("/account/1/sessions");
|
|
56
|
-
};
|
|
57
|
-
export const deleteAccount = async () => {
|
|
58
|
-
return await fetch("/account/1/delete", { method: "POST" });
|
|
59
|
-
};
|
|
60
|
-
export const confirmDeleteAccount = async (body) => {
|
|
61
|
-
await fetch("/account/1/delete", { body, method: "PUT" });
|
|
62
|
-
flush();
|
|
63
|
-
};
|
|
1
|
+
import { userActions } from "./index.mjs";
|
|
2
|
+
export default userActions;
|
|
@@ -1,2 +1,97 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare const useUserActions: () => {
|
|
2
|
+
signIn: (body: Record<string, any>) => Promise<import("src/runtime/packages/core").GetUserResponse | {
|
|
3
|
+
key: string;
|
|
4
|
+
}>;
|
|
5
|
+
signInByCodeSendCode: (body: Record<string, any>) => Promise<{
|
|
6
|
+
key: string;
|
|
7
|
+
}>;
|
|
8
|
+
signInByCodeVerifyCode: (body: Record<string, any>) => Promise<import("src/runtime/packages/core").GetUserResponse>;
|
|
9
|
+
signUp: (body: Record<string, any>) => Promise<{
|
|
10
|
+
key: string;
|
|
11
|
+
}>;
|
|
12
|
+
confirmEmail: (body: {
|
|
13
|
+
key: string;
|
|
14
|
+
code: string;
|
|
15
|
+
}) => Promise<{}>;
|
|
16
|
+
resendActivationEmail: (body: {
|
|
17
|
+
email: string;
|
|
18
|
+
}) => Promise<{
|
|
19
|
+
key: string;
|
|
20
|
+
}>;
|
|
21
|
+
logout: () => Promise<void>;
|
|
22
|
+
recovery: (body: Record<string, any>) => Promise<{
|
|
23
|
+
key: string;
|
|
24
|
+
}>;
|
|
25
|
+
confirmRecovery: (body: {
|
|
26
|
+
key: string;
|
|
27
|
+
code: string;
|
|
28
|
+
}) => Promise<{
|
|
29
|
+
key: string;
|
|
30
|
+
}>;
|
|
31
|
+
resetPassword: (body: {
|
|
32
|
+
key: string;
|
|
33
|
+
password: string;
|
|
34
|
+
}) => Promise<{}>;
|
|
35
|
+
changeName: (body: {
|
|
36
|
+
firstName: string;
|
|
37
|
+
lastName: string;
|
|
38
|
+
middleName: string;
|
|
39
|
+
}) => Promise<void>;
|
|
40
|
+
changeBirthday: (body: {
|
|
41
|
+
day?: number;
|
|
42
|
+
month?: number;
|
|
43
|
+
year?: number;
|
|
44
|
+
}) => Promise<void>;
|
|
45
|
+
changeGender: (body: {
|
|
46
|
+
gender: "" | "male" | "female";
|
|
47
|
+
}) => Promise<void>;
|
|
48
|
+
changePassword: (body: {
|
|
49
|
+
password: string;
|
|
50
|
+
newPassword: string;
|
|
51
|
+
}) => Promise<{
|
|
52
|
+
key: string;
|
|
53
|
+
}>;
|
|
54
|
+
confirmPasswordChange: (body: {
|
|
55
|
+
key: string;
|
|
56
|
+
code: string;
|
|
57
|
+
newPassword?: string;
|
|
58
|
+
}) => Promise<void>;
|
|
59
|
+
changeEmail: (body: {
|
|
60
|
+
email: string;
|
|
61
|
+
password: string;
|
|
62
|
+
}) => Promise<{
|
|
63
|
+
key: string;
|
|
64
|
+
}>;
|
|
65
|
+
confirmEmailChange: (body: {
|
|
66
|
+
key: string;
|
|
67
|
+
code: string;
|
|
68
|
+
email?: string;
|
|
69
|
+
}) => Promise<void>;
|
|
70
|
+
changePhone: (body: {
|
|
71
|
+
phone: string;
|
|
72
|
+
password: string;
|
|
73
|
+
}) => Promise<void>;
|
|
74
|
+
changeTheme: (body: {
|
|
75
|
+
theme: "light" | "dark";
|
|
76
|
+
}) => Promise<void>;
|
|
77
|
+
changeLocale: (body: {
|
|
78
|
+
locale: string;
|
|
79
|
+
}) => Promise<void>;
|
|
80
|
+
changeAvatar: (body: FormData) => Promise<void>;
|
|
81
|
+
deleteAvatar: () => Promise<void>;
|
|
82
|
+
fetchActiveSessions: () => Promise<{
|
|
83
|
+
sessions: import("src/runtime/packages/core").ActiveSession[];
|
|
84
|
+
}>;
|
|
85
|
+
logoutActiveSession: (body: {
|
|
86
|
+
sessionId: string;
|
|
87
|
+
visitorId: string;
|
|
88
|
+
}) => Promise<any>;
|
|
89
|
+
logoutFromAllActiveSessions: () => Promise<any>;
|
|
90
|
+
deleteAccount: () => Promise<{
|
|
91
|
+
key: string;
|
|
92
|
+
}>;
|
|
93
|
+
confirmDeleteAccount: (body: {
|
|
94
|
+
key: string;
|
|
95
|
+
code: string;
|
|
96
|
+
}) => Promise<void>;
|
|
97
|
+
};
|
|
@@ -5,7 +5,7 @@ import VantConfigProvider from "./vant"
|
|
|
5
5
|
import { useThemeMode, useUser } from "./index"
|
|
6
6
|
import type { ConfigProviderTheme } from "vant"
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
defineProps({ vantEnabled: { type: Boolean, default: true } })
|
|
9
9
|
|
|
10
10
|
const theme = useThemeMode()
|
|
11
11
|
const user = useUser()
|
|
@@ -17,8 +17,6 @@ onBeforeMount(() => {
|
|
|
17
17
|
|
|
18
18
|
onMounted(() => {
|
|
19
19
|
appLoading.value = false
|
|
20
|
-
// eslint-disable-next-line no-console
|
|
21
|
-
console.log("vant enabled", props.vantEnabled)
|
|
22
20
|
})
|
|
23
21
|
</script>
|
|
24
22
|
|
|
@@ -12,6 +12,9 @@ export declare function initApiFetch($fetch: Fetch, config: FetchConfig): {
|
|
|
12
12
|
signIn: (body: Record<string, any>) => Promise<import("./types").GetUserResponse | {
|
|
13
13
|
key: string;
|
|
14
14
|
}>;
|
|
15
|
+
signInByCodeSendCode: (body: Record<string, any>) => Promise<{
|
|
16
|
+
key: string;
|
|
17
|
+
}>;
|
|
15
18
|
signInByCodeVerifyCode: (body: Record<string, any>) => Promise<import("./types").GetUserResponse>;
|
|
16
19
|
signUp: (body: Record<string, any>) => Promise<{
|
|
17
20
|
key: string;
|
|
@@ -26,9 +29,19 @@ export declare function initApiFetch($fetch: Fetch, config: FetchConfig): {
|
|
|
26
29
|
key: string;
|
|
27
30
|
}>;
|
|
28
31
|
logout: () => Promise<void>;
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
recovery: (body: Record<string, any>) => Promise<{
|
|
33
|
+
key: string;
|
|
34
|
+
}>;
|
|
35
|
+
confirmRecovery: (body: {
|
|
36
|
+
key: string;
|
|
37
|
+
code: string;
|
|
38
|
+
}) => Promise<{
|
|
39
|
+
key: string;
|
|
31
40
|
}>;
|
|
41
|
+
resetPassword: (body: {
|
|
42
|
+
key: string;
|
|
43
|
+
password: string;
|
|
44
|
+
}) => Promise<{}>;
|
|
32
45
|
changeName: (body: {
|
|
33
46
|
firstName: string;
|
|
34
47
|
lastName: string;
|
|
@@ -76,17 +89,30 @@ export declare function initApiFetch($fetch: Fetch, config: FetchConfig): {
|
|
|
76
89
|
}) => Promise<void>;
|
|
77
90
|
changeAvatar: (body: FormData) => Promise<void>;
|
|
78
91
|
deleteAvatar: () => Promise<void>;
|
|
92
|
+
fetchActiveSessions: () => Promise<{
|
|
93
|
+
sessions: import("./types").ActiveSession[];
|
|
94
|
+
}>;
|
|
79
95
|
logoutActiveSession: (body: {
|
|
80
96
|
sessionId: string;
|
|
81
97
|
visitorId: string;
|
|
82
98
|
}) => Promise<any>;
|
|
83
99
|
logoutFromAllActiveSessions: () => Promise<any>;
|
|
100
|
+
deleteAccount: () => Promise<{
|
|
101
|
+
key: string;
|
|
102
|
+
}>;
|
|
103
|
+
confirmDeleteAccount: (body: {
|
|
104
|
+
key: string;
|
|
105
|
+
code: string;
|
|
106
|
+
}) => Promise<void>;
|
|
84
107
|
};
|
|
85
108
|
};
|
|
86
109
|
export declare const useUserActions: () => Ref<{
|
|
87
110
|
signIn: (body: Record<string, any>) => Promise<import("./types").GetUserResponse | {
|
|
88
111
|
key: string;
|
|
89
112
|
}>;
|
|
113
|
+
signInByCodeSendCode: (body: Record<string, any>) => Promise<{
|
|
114
|
+
key: string;
|
|
115
|
+
}>;
|
|
90
116
|
signInByCodeVerifyCode: (body: Record<string, any>) => Promise<import("./types").GetUserResponse>;
|
|
91
117
|
signUp: (body: Record<string, any>) => Promise<{
|
|
92
118
|
key: string;
|
|
@@ -101,9 +127,19 @@ export declare const useUserActions: () => Ref<{
|
|
|
101
127
|
key: string;
|
|
102
128
|
}>;
|
|
103
129
|
logout: () => Promise<void>;
|
|
104
|
-
|
|
105
|
-
|
|
130
|
+
recovery: (body: Record<string, any>) => Promise<{
|
|
131
|
+
key: string;
|
|
132
|
+
}>;
|
|
133
|
+
confirmRecovery: (body: {
|
|
134
|
+
key: string;
|
|
135
|
+
code: string;
|
|
136
|
+
}) => Promise<{
|
|
137
|
+
key: string;
|
|
106
138
|
}>;
|
|
139
|
+
resetPassword: (body: {
|
|
140
|
+
key: string;
|
|
141
|
+
password: string;
|
|
142
|
+
}) => Promise<{}>;
|
|
107
143
|
changeName: (body: {
|
|
108
144
|
firstName: string;
|
|
109
145
|
lastName: string;
|
|
@@ -151,15 +187,28 @@ export declare const useUserActions: () => Ref<{
|
|
|
151
187
|
}) => Promise<void>;
|
|
152
188
|
changeAvatar: (body: FormData) => Promise<void>;
|
|
153
189
|
deleteAvatar: () => Promise<void>;
|
|
190
|
+
fetchActiveSessions: () => Promise<{
|
|
191
|
+
sessions: import("./types").ActiveSession[];
|
|
192
|
+
}>;
|
|
154
193
|
logoutActiveSession: (body: {
|
|
155
194
|
sessionId: string;
|
|
156
195
|
visitorId: string;
|
|
157
196
|
}) => Promise<any>;
|
|
158
197
|
logoutFromAllActiveSessions: () => Promise<any>;
|
|
198
|
+
deleteAccount: () => Promise<{
|
|
199
|
+
key: string;
|
|
200
|
+
}>;
|
|
201
|
+
confirmDeleteAccount: (body: {
|
|
202
|
+
key: string;
|
|
203
|
+
code: string;
|
|
204
|
+
}) => Promise<void>;
|
|
159
205
|
}, {
|
|
160
206
|
signIn: (body: Record<string, any>) => Promise<import("./types").GetUserResponse | {
|
|
161
207
|
key: string;
|
|
162
208
|
}>;
|
|
209
|
+
signInByCodeSendCode: (body: Record<string, any>) => Promise<{
|
|
210
|
+
key: string;
|
|
211
|
+
}>;
|
|
163
212
|
signInByCodeVerifyCode: (body: Record<string, any>) => Promise<import("./types").GetUserResponse>;
|
|
164
213
|
signUp: (body: Record<string, any>) => Promise<{
|
|
165
214
|
key: string;
|
|
@@ -174,9 +223,19 @@ export declare const useUserActions: () => Ref<{
|
|
|
174
223
|
key: string;
|
|
175
224
|
}>;
|
|
176
225
|
logout: () => Promise<void>;
|
|
177
|
-
|
|
178
|
-
|
|
226
|
+
recovery: (body: Record<string, any>) => Promise<{
|
|
227
|
+
key: string;
|
|
179
228
|
}>;
|
|
229
|
+
confirmRecovery: (body: {
|
|
230
|
+
key: string;
|
|
231
|
+
code: string;
|
|
232
|
+
}) => Promise<{
|
|
233
|
+
key: string;
|
|
234
|
+
}>;
|
|
235
|
+
resetPassword: (body: {
|
|
236
|
+
key: string;
|
|
237
|
+
password: string;
|
|
238
|
+
}) => Promise<{}>;
|
|
180
239
|
changeName: (body: {
|
|
181
240
|
firstName: string;
|
|
182
241
|
lastName: string;
|
|
@@ -224,9 +283,19 @@ export declare const useUserActions: () => Ref<{
|
|
|
224
283
|
}) => Promise<void>;
|
|
225
284
|
changeAvatar: (body: FormData) => Promise<void>;
|
|
226
285
|
deleteAvatar: () => Promise<void>;
|
|
286
|
+
fetchActiveSessions: () => Promise<{
|
|
287
|
+
sessions: import("./types").ActiveSession[];
|
|
288
|
+
}>;
|
|
227
289
|
logoutActiveSession: (body: {
|
|
228
290
|
sessionId: string;
|
|
229
291
|
visitorId: string;
|
|
230
292
|
}) => Promise<any>;
|
|
231
293
|
logoutFromAllActiveSessions: () => Promise<any>;
|
|
294
|
+
deleteAccount: () => Promise<{
|
|
295
|
+
key: string;
|
|
296
|
+
}>;
|
|
297
|
+
confirmDeleteAccount: (body: {
|
|
298
|
+
key: string;
|
|
299
|
+
code: string;
|
|
300
|
+
}) => Promise<void>;
|
|
232
301
|
}> | undefined;
|
|
@@ -4,6 +4,9 @@ export declare const createApiUserActions: (fetch: Fetch, config: FetchConfig, g
|
|
|
4
4
|
signIn: (body: Record<string, any>) => Promise<GetUserResponse | {
|
|
5
5
|
key: string;
|
|
6
6
|
}>;
|
|
7
|
+
signInByCodeSendCode: (body: Record<string, any>) => Promise<{
|
|
8
|
+
key: string;
|
|
9
|
+
}>;
|
|
7
10
|
signInByCodeVerifyCode: (body: Record<string, any>) => Promise<GetUserResponse>;
|
|
8
11
|
signUp: (body: Record<string, any>) => Promise<{
|
|
9
12
|
key: string;
|
|
@@ -18,9 +21,19 @@ export declare const createApiUserActions: (fetch: Fetch, config: FetchConfig, g
|
|
|
18
21
|
key: string;
|
|
19
22
|
}>;
|
|
20
23
|
logout: () => Promise<void>;
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
recovery: (body: Record<string, any>) => Promise<{
|
|
25
|
+
key: string;
|
|
23
26
|
}>;
|
|
27
|
+
confirmRecovery: (body: {
|
|
28
|
+
key: string;
|
|
29
|
+
code: string;
|
|
30
|
+
}) => Promise<{
|
|
31
|
+
key: string;
|
|
32
|
+
}>;
|
|
33
|
+
resetPassword: (body: {
|
|
34
|
+
key: string;
|
|
35
|
+
password: string;
|
|
36
|
+
}) => Promise<{}>;
|
|
24
37
|
changeName: (body: {
|
|
25
38
|
firstName: string;
|
|
26
39
|
lastName: string;
|
|
@@ -68,9 +81,19 @@ export declare const createApiUserActions: (fetch: Fetch, config: FetchConfig, g
|
|
|
68
81
|
}) => Promise<void>;
|
|
69
82
|
changeAvatar: (body: FormData) => Promise<void>;
|
|
70
83
|
deleteAvatar: () => Promise<void>;
|
|
84
|
+
fetchActiveSessions: () => Promise<{
|
|
85
|
+
sessions: ActiveSession[];
|
|
86
|
+
}>;
|
|
71
87
|
logoutActiveSession: (body: {
|
|
72
88
|
sessionId: string;
|
|
73
89
|
visitorId: string;
|
|
74
90
|
}) => Promise<any>;
|
|
75
91
|
logoutFromAllActiveSessions: () => Promise<any>;
|
|
92
|
+
deleteAccount: () => Promise<{
|
|
93
|
+
key: string;
|
|
94
|
+
}>;
|
|
95
|
+
confirmDeleteAccount: (body: {
|
|
96
|
+
key: string;
|
|
97
|
+
code: string;
|
|
98
|
+
}) => Promise<void>;
|
|
76
99
|
};
|
|
@@ -20,6 +20,13 @@ 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
|
+
},
|
|
23
30
|
signInByCodeVerifyCode: async (body) => {
|
|
24
31
|
const response = await fetch("/account/0/signinbycode/verifycode", {
|
|
25
32
|
body,
|
|
@@ -64,8 +71,26 @@ export const createApiUserActions = once(
|
|
|
64
71
|
flush();
|
|
65
72
|
}
|
|
66
73
|
},
|
|
67
|
-
|
|
68
|
-
return await fetch("/account/
|
|
74
|
+
recovery: async (body) => {
|
|
75
|
+
return await fetch("/account/0/recovery", {
|
|
76
|
+
body,
|
|
77
|
+
method: "POST",
|
|
78
|
+
...config.useRequestHeaders?.(["cookie"]) ?? {}
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
confirmRecovery: async (body) => {
|
|
82
|
+
return await fetch("/account/0/recovery", {
|
|
83
|
+
body,
|
|
84
|
+
method: "PATCH",
|
|
85
|
+
...config.useRequestHeaders?.(["cookie"]) ?? {}
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
resetPassword: async (body) => {
|
|
89
|
+
return await fetch("/account/0/recovery", {
|
|
90
|
+
body,
|
|
91
|
+
method: "PUT",
|
|
92
|
+
...config.useRequestHeaders?.(["cookie"]) ?? {}
|
|
93
|
+
});
|
|
69
94
|
},
|
|
70
95
|
changeName: async (body) => {
|
|
71
96
|
await fetch("/account/1/change/name", {
|
|
@@ -130,11 +155,21 @@ export const createApiUserActions = once(
|
|
|
130
155
|
await fetch("/account/1/delete/avatar", { body: { avatar: user.value?.avatar }, method: "DELETE" });
|
|
131
156
|
updateUser({ avatar: "" });
|
|
132
157
|
},
|
|
158
|
+
fetchActiveSessions: async () => {
|
|
159
|
+
return await fetch("/account/1/sessions");
|
|
160
|
+
},
|
|
133
161
|
logoutActiveSession: async (body) => {
|
|
134
162
|
return await fetch("/account/1/logout/session", { body, method: "POST" });
|
|
135
163
|
},
|
|
136
164
|
logoutFromAllActiveSessions: async () => {
|
|
137
165
|
return await fetch("/account/1/logout/sessions", { method: "POST" });
|
|
166
|
+
},
|
|
167
|
+
deleteAccount: async () => {
|
|
168
|
+
return await fetch("/account/1/delete", { method: "POST" });
|
|
169
|
+
},
|
|
170
|
+
confirmDeleteAccount: async (body) => {
|
|
171
|
+
await fetch("/account/1/delete", { body, method: "PUT" });
|
|
172
|
+
flush();
|
|
138
173
|
}
|
|
139
174
|
};
|
|
140
175
|
}
|