Fix change-password form to use direct fetch instead of authClient

authClient.changePassword does not exist in better-auth v1.6 client bundle.
Use direct POST to /api/auth/change-password endpoint instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-11 17:10:18 +05:00
parent c445bfacad
commit 799117d287
@@ -1,7 +1,6 @@
"use client";
import { useState } from "react";
import { authClient } from "@/lib/auth-client";
const inputStyle: React.CSSProperties = {
border: "2px solid var(--border)",
@@ -33,14 +32,14 @@ export function ChangePasswordForm() {
}
setLoading(true);
const result = await authClient.changePassword({
currentPassword: current,
newPassword: next,
revokeOtherSessions: false,
const res = await fetch("/api/auth/change-password", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ currentPassword: current, newPassword: next, revokeOtherSessions: false }),
});
setLoading(false);
if (result.error) {
if (!res.ok) {
setError("Неверный текущий пароль");
return;
}