Добавлены модальные формы для редактирования профиля и смены пароля. Обновлены API запросы для работы с данными пользователя.
44 lines
1.5 KiB
JavaScript
44 lines
1.5 KiB
JavaScript
import {createApi} from "@reduxjs/toolkit/query/react";
|
|
import {baseQueryWithAuth} from "./baseQuery.js";
|
|
|
|
export const scheduledAppointmentsApi = createApi({
|
|
reducerPath: 'scheduledAppointmentsApi',
|
|
baseQuery: baseQueryWithAuth,
|
|
tagTypes: ['ScheduledAppointment'],
|
|
endpoints: (builder) => ({
|
|
getScheduledAppointments: builder.query({
|
|
query: (doctor_id) => `/scheduled_appointments/doctor/${doctor_id}/`,
|
|
providesTags: ['ScheduledAppointment'],
|
|
}),
|
|
createScheduledAppointment: builder.mutation({
|
|
query: (data) => ({
|
|
url: '/scheduled_appointments/',
|
|
method: 'POST',
|
|
body: data,
|
|
}),
|
|
invalidatesTags: ['ScheduledAppointment'],
|
|
}),
|
|
updateScheduledAppointment: builder.mutation({
|
|
query: ({id, data}) => ({
|
|
url: `/scheduled_appointments/${id}/`,
|
|
method: 'PUT',
|
|
body: data,
|
|
}),
|
|
invalidatesTags: ['ScheduledAppointment'],
|
|
}),
|
|
cancelScheduledAppointment: builder.mutation({
|
|
query: (id) => ({
|
|
url: `/scheduled_appointments/${id}/cancel/`,
|
|
method: 'POST',
|
|
}),
|
|
invalidatesTags: ['ScheduledAppointment'],
|
|
}),
|
|
}),
|
|
});
|
|
|
|
export const {
|
|
useGetScheduledAppointmentsQuery,
|
|
useCreateScheduledAppointmentMutation,
|
|
useUpdateScheduledAppointmentMutation,
|
|
useCancelScheduledAppointmentMutation,
|
|
} = scheduledAppointmentsApi; |