Skip to content

Phase 3: handle Civil ID removal failures in candidate UI#32

Open
its-amann wants to merge 2 commits into
BAWES-Universe:mainfrom
its-amann:bounty/issue-55-phase-3-candidate-civil-id-ui
Open

Phase 3: handle Civil ID removal failures in candidate UI#32
its-amann wants to merge 2 commits into
BAWES-Universe:mainfrom
its-amann:bounty/issue-55-phase-3-candidate-civil-id-ui

Conversation

@its-amann

@its-amann its-amann commented May 15, 2026

Copy link
Copy Markdown

/claim #55

Related to BAWES-Universe/studenthub#55.

This PR handles the candidate-side Phase 3 Civil ID UI failure path:

  • Keeps broken Civil ID image previews local to the Civil ID page instead of automatically calling remove endpoints from image onError
  • Shows a clear preview fallback and destructive toast when front/back previews cannot load
  • Catches remove-front/remove-back API failures locally so backend 500 responses do not route the whole app to the global server-error screen
  • Adds a fromProfile=1 back-to-profile affordance so candidates are not trapped on the Civil ID page after a partial failure
  • Adds a focused regression test for suppressing the global Axios 500 handler

Verification run locally:

  • npm run test.unit -- src/providers/AxiosService.test.ts --run
  • git diff --check
  • npm run build
  • npm run lint

Notes:

  • npm run build reports existing Browserslist data age and missing theme_color PWA warnings, but exits 0.
  • npm ci reports existing dependency vulnerabilities; not changed in this PR.

@coderabbitai

coderabbitai Bot commented May 15, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@its-amann has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 55 minutes and 31 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 85906d7e-6d9a-46e8-91b8-39ed29ca5140

📥 Commits

Reviewing files that changed from the base of the PR and between 30a036b and 0814f33.

📒 Files selected for processing (4)
  • src/pages/(auth)/civil-id/page.tsx
  • src/providers/AxiosService.test.ts
  • src/providers/AxiosService.ts
  • src/providers/logged-in/account.service.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@BAWES BAWES left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved — Civil ID removal error handling

Review: Clean addition of error handling for Civil ID photo removal failures.

Strengths:

  • Error state handling with toast notifications for both front/back photo removal
  • Preview failure detection with guard (frontIdPreviewFailed/backIdPreviewFailed) prevents toast spam
  • Proper error message extraction from API response
  • Resets preview failure state on successful upload/re-upload
  • TDD-consistent: adds state handling, then error display, then integration

Nitpick (non-blocking): The removeCivilPhotoErrorDescription function takes error: any — consider typing with AxiosError or a union type if the error shape is known.

CodeRabbit skipped ✅ | No CI checks defined for this repo

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.

2 participants