You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(client): register login form validations implementation
User description
Description
Changes Made
How to Test
Steps to reproduce/test the behavior
Expected outcomes
Notes
PR Type
Enhancement, Bug fix
Description
• Add client-side form validation and error messages
• Introduce password strength tooltip and rules
• Reset registration form and clear alerts on success
• Enhance auth API error handling in store
Changes walkthrough 📝
Relevant files
Enhancement
LoginPage.tsx
Improve form validations and UI feedback
packages/client/src/pages/LoginPage.tsx
• Added formState errors and onChange validation mode • Defined validation rules with custom error messages • Introduced password strength tooltip content • Wrapped alerts with severity and reset on success
• Wrapped axios calls in try/catch with validateStatus • Threw errors based on response.errorMessage • Removed chained catch and improved error propagation
The PHONE controller now applies a strict 10-digit pattern on every change, causing empty inputs (which were previously allowed) to be flagged as invalid. Consider making the pattern check conditional so that blank values pass validation for an optional field.
<Controllername={'PHONE'}control={registerControl}rules={{pattern: {value: /^\d{10}$/,message:
'Please enter valid Phone Number',},}}
The new axios calls in login and createUser always return true or rethrow based on error.message, without checking HTTP status codes or preserving response details. This can mask server errors and make debugging harder. Consider validating status codes and including full error context.
-if (response?.data?.errorMessage) {- throw new Error(response.data.errorMessage);+if (response.status >= 400) {+ throw new Error(response.data?.errorMessage || `Request failed with status ${response.status}`);
}
Suggestion importance[1-10]: 6
__
Why: Throwing on any non-2xx status guarantees failures surface even without an explicit errorMessage, improving error handling.
Low
General
Clear loading state on success
Ensure the loading state is cleared after registration succeeds by moving setIsLoading(false) into a finally block or immediately after reset().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implemented validation messages for both Register and Login forms to improve user experience and error handling.
Changes Made
LoginPage.tsx
monolith.store.ts
How to Test