-
Notifications
You must be signed in to change notification settings - Fork 516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues/#9686/forgot password error handling #9704
Issues/#9686/forgot password error handling #9704
Conversation
WalkthroughThe pull request modifies the Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
src/components/Auth/Login.tsx (3)
101-121
: Refine error handling for clarity and i18n support.Here, the error message is hardcoded as "Network Error," which may not be accurate or internationalized for all failure scenarios. Additionally, using
any
for the error type can lead to unpredictable behavior when accessing error properties.Consider the following approach:
- Use the translated string for network errors, e.g.
t("network_error")
.- Display more detailed error information if it exists, falling back to the translation string otherwise.
- Use a refined type for errors to ensure safer property access:
-onError: (error: any) => { - setErrors(error); - Notification.Error({ msg: "Network Error" }); +onError: (error: { message?: string } & Record<string, any>) => { + setErrors(error); + Notification.Error({ + msg: error?.message ?? t("network_error"), + }); }
300-300
: Add type annotation for thevalid
object.Currently,
forgotPasswordMutation(valid)
is called without clarifying the typed shape ofvalid
. Adding a type annotation improves readability, maintainability, and reduces future bugs.- forgotPasswordMutation(valid); + forgotPasswordMutation(valid as { username: string });
331-331
: Adopt consistent naming across loading states.The code uses both
isLoading
andisPending
for tracking ongoing operations, which may cause confusion and reduce clarity. Consider renamingisPending
toisLoading
or vice versa for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mutate already throws for you. let's not do this
Proposed Changes
@ohcnetwork/care-fe-code-reviewers
Merge Checklist
Summary by CodeRabbit
New Features
Bug Fixes
Refactor