Changeset 9af201e for frontend/src/pages/Dashboard.js
- Timestamp:
- 09/04/26 19:08:08 (2 weeks ago)
- Branches:
- master
- Children:
- cdcff72
- Parents:
- e1f74f6
- File:
-
- 1 edited
-
frontend/src/pages/Dashboard.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
frontend/src/pages/Dashboard.js
re1f74f6 r9af201e 6 6 import { labService } from '../services/labService'; 7 7 import { billingService } from '../services/billingService'; 8 import { medicalRecordService } from '../services/medicalRecordService';9 8 import Loading from '../components/Loading'; 10 9 … … 19 18 const [pendingLabTests, setPendingLabTests] = useState([]); 20 19 const [billings, setBillings] = useState([]); 21 const [medicalRecords, setMedicalRecords] = useState([]);22 20 const [patientBillings, setPatientBillings] = useState([]); 23 21 const [loading, setLoading] = useState(true); … … 33 31 if (isPatient) { 34 32 // For patients, fetch their own appointments, medical records, and billing 35 const [appointmentsRes, medicalRes,billingRes] = await Promise.all([33 const [appointmentsRes, billingRes] = await Promise.all([ 36 34 appointmentService.getAppointmentsForPatient(user.patientId), 37 medicalRecordService.getMedicalRecordByPatientId(user.patientId),38 35 billingService.getBillingHistoryForPatient(user.patientId) 39 36 ]); 40 37 setUserAppointments(appointmentsRes.data || []); 41 // Handle medical records - could be single object or array42 const medicalData = medicalRes.data;43 const medicalArray = Array.isArray(medicalData) ? medicalData : (medicalData ? [medicalData] : []);44 setMedicalRecords(medicalArray);45 38 setPatientBillings(billingRes.data || []); 46 39 } else if (isDoctor) { … … 82 75 83 76 fetchStats(); 84 }, [ user.userId, isPatient, isDoctor, isLabTechnician]);77 }, []); 85 78 86 79 if (loading) return <Loading />;
Note:
See TracChangeset
for help on using the changeset viewer.
