password reset fail message

This commit is contained in:
BFlat
2026-03-24 16:59:22 +07:00
parent 4d53d9af18
commit 4bdb1c89a4
+20 -20
View File
@@ -1,4 +1,5 @@
import { ApiManager, ApiResponse } from "./ApiManager.js";
import { FetchProxy as fetch } from "@storyteller/tauri-utils";
export class PasswordResetApi extends ApiManager {
public async RequestPasswordReset({
@@ -58,30 +59,29 @@ export class PasswordResetApi extends ApiManager {
};
try {
const response = await this.post<
{
reset_token: string;
new_password: string;
new_password_validation: string;
const response = await fetch(endpoint, {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
},
{
success: boolean;
error_type?: string;
error_fields?: Record<string, string>;
error_message?: string;
}
>({
endpoint: endpoint,
body: body,
credentials: "include",
body: JSON.stringify(body),
});
const data = await response.json();
if (!response.ok) {
return {
success: false,
errorMessage:
data.message ||
"Failed to reset password. Please try again.",
};
}
return {
success: response.success,
errorMessage:
response.error_message ||
(response.error_fields
? Object.values(response.error_fields).join(", ")
: undefined),
success: data.success,
};
} catch (err: any) {
return {