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 Forbiddenfrom/api/v1/users/{id} -
405 Method Not Allowedfrom/api/v1/doctors/{id}
-
- The frontend was incorrectly calling the
/usersendpoint for patient profiles. - Volunteer role does not have permission to access
/users, causing the 403 error.
Fix
- Updated
fetchProfileDatalogic to call the correct endpoint:-
GET /api/v1/patients/{id}whenexplicitType === "patient" -
GET /api/v1/doctors/{id}whenexplicitType === "doctor" -
GET /api/v1/users/{id}only whenexplicitType === "user"
-
- Removed incorrect fallback logic that tried
/doctorswhen/usersfailed. - 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 |
|
|
|
| Patient profile showed "Request failed with status code 403" error | Patient profile loads successfully with correct data |
How to set up and validate locally
- Checkout the branch:
git checkout fix/patientprofile
related issue #208 (closed)