Fix: Handle duplicate email and validation errors in newsletter subscription .#404
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe footer's ChangesNewsletter subscription status handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@client/src/components/Footer.tsx`:
- Around line 38-40: Replace the hardcoded 400 error message in the Footer
component's error handling so that when err.response?.status === 400 you first
read the backend validation message (e.g., err.response?.data?.message or
err.response?.data?.errors[0]?.message) and pass that to setError, falling back
to "Please enter a valid email address." if no message exists; update the branch
that currently calls setError("Please enter a valid email address.") to use the
API payload with safe optional chaining and a fallback.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8f51a5a3-8cc1-4e5a-9db6-07bf9890ea19
📒 Files selected for processing (1)
client/src/components/Footer.tsx
|
@Sachinchaurasiya360 CodeRabbit has also reviewed and approved the changes. |
|
Changes applied manually to main with the following fixes: removed duplicate e.preventDefault(), changed |
…ription (#404) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
Handle backend response cases in newsletter subscription form
that were previously ignored by the frontend.
Changes
201response: show success message for new subscribers200response: show "already subscribed" error message400error: show "valid email required" message from backend409error: show duplicate email message as extra safety netHow to test
abc@→ should show validation errorFixes #363
Summary by CodeRabbit