fixed the patient profile in quick search

What does this MR do and why?

This MR fixes an issue where the Patient Profile was not loading when accessed from Quick Search.

Problem

  • Quick Search successfully returned patient results.
  • When clicking on a patient, profile fetch failed.
  • Console showed:
    • 403 Forbidden from /api/v1/users/{id}
    • 405 Method Not Allowed from /api/v1/doctors/{id}
  • The frontend was incorrectly calling the /users endpoint for patient profiles.
  • Volunteer role does not have permission to access /users, causing the 403 error.

Fix

  • Updated fetchProfileData logic to call the correct endpoint:
    • GET /api/v1/patients/{id} when explicitType === "patient"
    • GET /api/v1/doctors/{id} when explicitType === "doctor"
    • GET /api/v1/users/{id} only when explicitType === "user"
  • Removed incorrect fallback logic that tried /doctors when /users failed.
  • No UI changes.
  • No response structure changes.
  • No functionality changes.

This ensures the patient profile loads correctly for volunteer users.


References

  • Fixes issue: Patient profile not loading from Quick Search
  • Error observed: 403 Forbidden (role restriction)
  • Related branch: fix/patientprofile

Screenshots or screen recordings

| Before | After | | image |image| | Patient profile showed "Request failed with status code 403" error | Patient profile loads successfully with correct data |


How to set up and validate locally

  1. Checkout the branch:
    git checkout fix/patientprofile
    

related issue #208 (closed)

Merge request reports

Loading