Внесены изменения в UI компонентов, исправлены ошибки. Добавлена возможность удаления файлов. Изменен CORS для API. Удален axiosConfig.js.
36 lines
1.3 KiB
JavaScript
36 lines
1.3 KiB
JavaScript
import { useGetPatientsQuery } from "../../../Api/patientsApi.js";
|
|
import { useGetAppointmentTypesQuery } from "../../../Api/appointmentTypesApi.js";
|
|
import {
|
|
useCreateAppointmentMutation,
|
|
useGetByPatientIdQuery,
|
|
} from "../../../Api/appointmentsApi.js";
|
|
import { useCancelScheduledAppointmentMutation } from "../../../Api/scheduledAppointmentsApi.js";
|
|
|
|
const useAppointmentFormModal = () => {
|
|
const {
|
|
data: patients = [],
|
|
isLoading: isLoadingPatients,
|
|
isError: isErrorPatients,
|
|
} = useGetPatientsQuery(undefined);
|
|
const {
|
|
data: appointmentTypes = [],
|
|
isLoading: isLoadingAppointmentTypes,
|
|
isError: isErrorAppointmentTypes,
|
|
} = useGetAppointmentTypesQuery(undefined);
|
|
|
|
const [createAppointment, { isLoading: isCreating, isError: isErrorCreating }] = useCreateAppointmentMutation();
|
|
const [cancelAppointment] = useCancelScheduledAppointmentMutation();
|
|
|
|
return {
|
|
patients,
|
|
appointmentTypes,
|
|
createAppointment,
|
|
cancelAppointment,
|
|
useGetByPatientIdQuery,
|
|
isLoading: isLoadingPatients || isLoadingAppointmentTypes || isCreating,
|
|
isError: isErrorPatients || isErrorAppointmentTypes || isErrorCreating,
|
|
isCreating,
|
|
};
|
|
};
|
|
|
|
export default useAppointmentFormModal; |