mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-12-23 22:58:17 -05:00
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:
File diff suppressed because it is too large
Load Diff
@@ -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');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user