improved error messages

This commit is contained in:
Oliver Bryan
2026-01-16 23:18:35 +00:00
parent 28d464299f
commit 7d0e8df6a3
2 changed files with 39 additions and 37 deletions

View File

@@ -98,7 +98,9 @@ export default function LogInForm() {
}
// bad request (probably a bad user input)
else if (res.status === 400) {
setError(await res.text());
const data = await res.json();
const firstDetail = data.details ? Object.values(data.details).flat().find(Boolean) : "";
setError(firstDetail || data.error || "Bad request");
} else {
setError("An unknown error occured.");
}