From 7a2733cda6fd99b33ca4c843b28c473313b2e03c Mon Sep 17 00:00:00 2001 From: andrei Date: Sun, 8 Jun 2025 10:23:44 +0500 Subject: [PATCH] =?UTF-8?q?refactor:=20=D0=97=D0=B0=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=20useGetPatientsQuery=20=D0=BD=D0=B0=20useGetAllPatients?= =?UTF-8?q?Query?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppointmentFormModal/useAppointmentFormModal.js | 4 ++-- .../useAppointmentCalendar.js | 13 ------------- .../Pages/AppointmentsPage/useAppointments.js | 4 ++-- .../src/Components/Pages/HomePage/useHomePage.js | 8 ++++---- 4 files changed, 8 insertions(+), 21 deletions(-) delete mode 100644 web-app/src/Components/Pages/AppointmentsPage/Components/AppointmentCalendarTab/useAppointmentCalendar.js diff --git a/web-app/src/Components/Dummies/AppointmentFormModal/useAppointmentFormModal.js b/web-app/src/Components/Dummies/AppointmentFormModal/useAppointmentFormModal.js index 8e758c9..b900aac 100644 --- a/web-app/src/Components/Dummies/AppointmentFormModal/useAppointmentFormModal.js +++ b/web-app/src/Components/Dummies/AppointmentFormModal/useAppointmentFormModal.js @@ -1,4 +1,4 @@ -import {useGetPatientsQuery} from "../../../Api/patientsApi.js"; +import {useGetAllPatientsQuery, useGetPatientsQuery} from "../../../Api/patientsApi.js"; import {useGetAppointmentTypesQuery} from "../../../Api/appointmentTypesApi.js"; import { useCreateAppointmentMutation, @@ -11,7 +11,7 @@ const useAppointmentFormModal = () => { data: patients = [], isLoading: isLoadingPatients, isError: isErrorPatients, - } = useGetPatientsQuery(undefined); + } = useGetAllPatientsQuery(undefined); const { data: appointmentTypes = [], isLoading: isLoadingAppointmentTypes, diff --git a/web-app/src/Components/Pages/AppointmentsPage/Components/AppointmentCalendarTab/useAppointmentCalendar.js b/web-app/src/Components/Pages/AppointmentsPage/Components/AppointmentCalendarTab/useAppointmentCalendar.js deleted file mode 100644 index b840c95..0000000 --- a/web-app/src/Components/Pages/AppointmentsPage/Components/AppointmentCalendarTab/useAppointmentCalendar.js +++ /dev/null @@ -1,13 +0,0 @@ -import {useCreateAppointmentMutation, useUpdateAppointmentMutation} from "../../../../../Api/appointmentsApi.js"; -import { - useCreateScheduledAppointmentMutation, - useUpdateScheduledAppointmentMutation -} from "../../../../../Api/scheduledAppointmentsApi.js"; - - -const useAppointmentCalendar = () => { - const [createAppointment] = useCreateAppointmentMutation(); - const [updateAppointment] = useUpdateAppointmentMutation(); - const [createScheduledAppointment] = useCreateScheduledAppointmentMutation(); - const [updateScheduledAppointment] = useUpdateScheduledAppointmentMutation(); -}; \ No newline at end of file diff --git a/web-app/src/Components/Pages/AppointmentsPage/useAppointments.js b/web-app/src/Components/Pages/AppointmentsPage/useAppointments.js index ad3baa1..87bb150 100644 --- a/web-app/src/Components/Pages/AppointmentsPage/useAppointments.js +++ b/web-app/src/Components/Pages/AppointmentsPage/useAppointments.js @@ -1,6 +1,6 @@ import {useGetAppointmentsQuery} from "../../../Api/appointmentsApi.js"; import {useGetScheduledAppointmentsQuery} from "../../../Api/scheduledAppointmentsApi.js"; -import {useGetPatientsQuery} from "../../../Api/patientsApi.js"; +import {useGetAllPatientsQuery} from "../../../Api/patientsApi.js"; import {notification} from "antd"; import {useEffect} from "react"; import {useSelector} from "react-redux"; @@ -30,7 +30,7 @@ const useAppointments = () => { data: patients = [], isLoading: isLoadingPatients, isError: isErrorPatients, - } = useGetPatientsQuery(undefined, { + } = useGetAllPatientsQuery(undefined, { pollingInterval: 20000, }); diff --git a/web-app/src/Components/Pages/HomePage/useHomePage.js b/web-app/src/Components/Pages/HomePage/useHomePage.js index 5e1a534..72d2d75 100644 --- a/web-app/src/Components/Pages/HomePage/useHomePage.js +++ b/web-app/src/Components/Pages/HomePage/useHomePage.js @@ -1,6 +1,6 @@ import {useGetAppointmentsQuery} from "../../../Api/appointmentsApi.js"; import {useGetScheduledAppointmentsQuery} from "../../../Api/scheduledAppointmentsApi.js"; -import {useGetPatientsQuery} from "../../../Api/patientsApi.js"; +import {useGetAllPatientsQuery} from "../../../Api/patientsApi.js"; import {notification} from "antd"; import {useEffect} from "react"; import {useDispatch, useSelector} from "react-redux"; @@ -15,9 +15,9 @@ import { } from "../../../Redux/Slices/patientsSlice.js"; import dayjs from "dayjs"; import isBetween from "dayjs/plugin/isBetween"; -import {useGetAppointmentTypesQuery} from "../../../Api/appointmentTypesApi.js"; // Import isBetween plugin +import {useGetAppointmentTypesQuery} from "../../../Api/appointmentTypesApi.js"; -dayjs.extend(isBetween); // Extend dayjs with isBetween +dayjs.extend(isBetween); const useHomePage = () => { const dispatch = useDispatch(); @@ -46,7 +46,7 @@ const useHomePage = () => { data: patients = [], isLoading: isLoadingPatients, isError: isErrorPatients, - } = useGetPatientsQuery(undefined, { + } = useGetAllPatientsQuery(undefined, { pollingInterval: 20000, });