fix: Change auth error response formatting

This commit is contained in:
April Hall 2025-02-13 10:40:42 -05:00
parent 644deb31d7
commit fb2592960c
No known key found for this signature in database
GPG Key ID: A49AC35CB186266C
2 changed files with 4 additions and 8 deletions

View File

@ -54,13 +54,8 @@ export const actions = {
}); });
} }
} catch (e) { } catch (e) {
if ((e as APIError).body.code === 'INVALID_EMAIL_OR_PASSWORD') { const errorMessage = (e as APIError).body.message as string;
return setError(form, 'password', 'Invalid email or password', { return setError(form, 'password', errorMessage.charAt(0).toUpperCase() + errorMessage.slice(1));
status: 401,
});
} else {
return setError(form, 'password', (e as APIError).message as string);
}
} }
return message(form, 'Successfuly signed in.'); return message(form, 'Successfuly signed in.');

View File

@ -57,7 +57,8 @@ export const actions = {
}); });
} }
} catch (e) { } catch (e) {
return setError(form, 'verify', (e as APIError).message as string); const errorMessage = (e as APIError).body.message as string;
return setError(form, 'verify', errorMessage.charAt(0).toUpperCase() + errorMessage.slice(1));
} }
return message(form, 'Successfuly signed in.'); return message(form, 'Successfuly signed in.');