Skip to content

[FIX] Add error feedback and toast notification to CategoryFormModal#286

Open
Siddh2024 wants to merge 1 commit into
rdodiya:gssoc_developfrom
Siddh2024:fix/283-category-form-error-feedback
Open

[FIX] Add error feedback and toast notification to CategoryFormModal#286
Siddh2024 wants to merge 1 commit into
rdodiya:gssoc_developfrom
Siddh2024:fix/283-category-form-error-feedback

Conversation

@Siddh2024

Copy link
Copy Markdown
Contributor

Description

Added user-facing error feedback to the category creation modal. Previously, API errors were silently swallowed with only a console.error call.

Changes Made

  • Added submitError state variable to track API error messages
  • Added inline error banner with AlertCircle icon that appears on failure
  • Added toast.success() on successful category creation
  • Added toast.error() with the API error message on failure
  • Error clears automatically when the user edits any field
  • Imported AlertCircle from lucide-react and toast from react-hot-toast

Testing

  1. Open Add Category modal
  2. Submit with valid data → toast.success shown, modal closes
  3. Force API error (e.g., network disconnect) → inline error banner + toast.error shown
  4. Edit a field → error clears automatically

Fixes #283

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] CategoryFormModal silently fails on API error — no user feedback

1 participant