feat: 实现更改登录密码功能,集成API调用并优化提交逻辑
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
import { toastController } from "@ionic/vue";
|
import { toastController } from "@ionic/vue";
|
||||||
import { eyeOffOutline, eyeOutline, lockClosedOutline } from "ionicons/icons";
|
import { eyeOffOutline, eyeOutline, lockClosedOutline } from "ionicons/icons";
|
||||||
import zod from "zod";
|
import zod from "zod";
|
||||||
|
import { safeClient } from "@/api";
|
||||||
|
import { authClient } from "@/auth";
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
@@ -59,14 +61,11 @@ async function handleSubmit() {
|
|||||||
|
|
||||||
isSubmitting.value = true;
|
isSubmitting.value = true;
|
||||||
try {
|
try {
|
||||||
// TODO: 调用更改登录密码 API
|
await safeClient(authClient.changePassword({
|
||||||
// const { data } = await safeClient(client.api.user.password.put({
|
newPassword: formData.value.newPassword, // required
|
||||||
// currentPassword: formData.value.currentPassword,
|
currentPassword: formData.value.currentPassword, // required
|
||||||
// newPassword: formData.value.newPassword,
|
revokeOtherSessions: true,
|
||||||
// }));
|
}));
|
||||||
|
|
||||||
// 模拟 API 调用
|
|
||||||
await new Promise(resolve => setTimeout(resolve, 1500));
|
|
||||||
|
|
||||||
await showToast("登录密码修改成功,请使用新密码登录", "success");
|
await showToast("登录密码修改成功,请使用新密码登录", "success");
|
||||||
router.back();
|
router.back();
|
||||||
|
|||||||
Reference in New Issue
Block a user