source: frontend/src/services/appointmentService.js@ 20468d3

Last change on this file since 20468d3 was 20468d3, checked in by MBK <marija.karapandzova@…>, 4 months ago

Add pages and routing for patients, doctors, departments and appointments with api services

  • Property mode set to 100644
File size: 774 bytes
Line 
1import apiClient from './api';
2
3const ENDPOINT = '/appointments';
4
5export const appointmentService = {
6 getAllAppointments: () => apiClient.get(ENDPOINT),
7
8 getAppointmentById: (id) => apiClient.get(`${ENDPOINT}/${id}`),
9
10 getAppointmentsForPatient: (patientId) => apiClient.get(`${ENDPOINT}/patient/${patientId}`),
11
12 getAppointmentsForDoctor: (doctorId) => apiClient.get(`${ENDPOINT}/doctor/${doctorId}`),
13
14 getDoctorSchedule: (doctorId, date) => apiClient.get(`${ENDPOINT}/doctor/${doctorId}/schedule`, {
15 params: { date }
16 }),
17
18 createAppointment: (appointment) => apiClient.post(ENDPOINT, appointment),
19
20 cancelAppointment: (id) => apiClient.patch(`${ENDPOINT}/${id}/cancel`),
21
22 completeAppointment: (id) => apiClient.patch(`${ENDPOINT}/${id}/complete`),
23};
Note: See TracBrowser for help on using the repository browser.