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