Files
The_DisExcel_project/frontend/src/api/ResetAPI/Reset.ts
T

11 lines
457 B
TypeScript

export async function requestPasswordReset(email: string): Promise<void> {
const res = await fetch(`http://localhost:8000/protected/reset?${new URLSearchParams({ email })}`, {
method: "POST",
credentials: "include",
});
if (!res.ok) {
const body = await res.json().catch(() => null);
throw new Error(typeof body?.detail === "string" ? body.detail : "Не удалось отправить запрос");
}
}