fix: handle email verification required case during signup

Updated the signup action to return a specific message when the backend responds with a 401 status, indicating that the signup succeeded but email verification is required. This allows the frontend to display the appropriate message using an i18n key.
This commit is contained in:
Sean Morley
2025-12-14 16:28:12 -05:00
parent bdb2d54188
commit c176beeada
2 changed files with 1052 additions and 1044 deletions

View File

File diff suppressed because it is too large Load Diff

View File

@@ -70,7 +70,13 @@ export const actions: Actions = {
const loginResponse = await loginFetch.json();
if (!loginFetch.ok) {
return fail(loginFetch.status, { message: loginResponse.errors[0].code });
// If backend returns 401, signup succeeded but email verification is required.
// Return an i18n key (not raw text) so the frontend can show the proper message.
if (loginFetch.status === 401) {
return { message: 'auth.user_email_verification_required' };
}
return fail(loginFetch.status, { message: loginResponse?.errors?.[0]?.code });
} else {
const setCookieHeader = loginFetch.headers.get('Set-Cookie');