fix: improve error handling for registration response

This commit is contained in:
2026-01-07 10:24:16 -05:00
parent ce66fe13e8
commit d514e456bf
@@ -95,8 +95,13 @@
} }
} }
} else { } else {
const payload = await res.json().catch(() => null); const resData = await res.json();
error = payload?.message ?? 'Registration failed'; if (resData.errors) {
const messages = Object.values(resData.errors).flat();
error = messages.join('\n');
} else {
error = resData.message || 'Registration failed. Please try again.';
}
} }
loading = false; loading = false;
} }