refactor: Замена useGetPatientsQuery на useGetAllPatientsQuery

This commit is contained in:
Андрей Дувакин 2025-06-08 10:23:44 +05:00
parent 7a2ef98fd5
commit 7a2733cda6
4 changed files with 8 additions and 21 deletions

View File

@ -1,4 +1,4 @@
import {useGetPatientsQuery} from "../../../Api/patientsApi.js"; import {useGetAllPatientsQuery, useGetPatientsQuery} from "../../../Api/patientsApi.js";
import {useGetAppointmentTypesQuery} from "../../../Api/appointmentTypesApi.js"; import {useGetAppointmentTypesQuery} from "../../../Api/appointmentTypesApi.js";
import { import {
useCreateAppointmentMutation, useCreateAppointmentMutation,
@ -11,7 +11,7 @@ const useAppointmentFormModal = () => {
data: patients = [], data: patients = [],
isLoading: isLoadingPatients, isLoading: isLoadingPatients,
isError: isErrorPatients, isError: isErrorPatients,
} = useGetPatientsQuery(undefined); } = useGetAllPatientsQuery(undefined);
const { const {
data: appointmentTypes = [], data: appointmentTypes = [],
isLoading: isLoadingAppointmentTypes, isLoading: isLoadingAppointmentTypes,

View File

@ -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();
};

View File

@ -1,6 +1,6 @@
import {useGetAppointmentsQuery} from "../../../Api/appointmentsApi.js"; import {useGetAppointmentsQuery} from "../../../Api/appointmentsApi.js";
import {useGetScheduledAppointmentsQuery} from "../../../Api/scheduledAppointmentsApi.js"; import {useGetScheduledAppointmentsQuery} from "../../../Api/scheduledAppointmentsApi.js";
import {useGetPatientsQuery} from "../../../Api/patientsApi.js"; import {useGetAllPatientsQuery} from "../../../Api/patientsApi.js";
import {notification} from "antd"; import {notification} from "antd";
import {useEffect} from "react"; import {useEffect} from "react";
import {useSelector} from "react-redux"; import {useSelector} from "react-redux";
@ -30,7 +30,7 @@ const useAppointments = () => {
data: patients = [], data: patients = [],
isLoading: isLoadingPatients, isLoading: isLoadingPatients,
isError: isErrorPatients, isError: isErrorPatients,
} = useGetPatientsQuery(undefined, { } = useGetAllPatientsQuery(undefined, {
pollingInterval: 20000, pollingInterval: 20000,
}); });

View File

@ -1,6 +1,6 @@
import {useGetAppointmentsQuery} from "../../../Api/appointmentsApi.js"; import {useGetAppointmentsQuery} from "../../../Api/appointmentsApi.js";
import {useGetScheduledAppointmentsQuery} from "../../../Api/scheduledAppointmentsApi.js"; import {useGetScheduledAppointmentsQuery} from "../../../Api/scheduledAppointmentsApi.js";
import {useGetPatientsQuery} from "../../../Api/patientsApi.js"; import {useGetAllPatientsQuery} from "../../../Api/patientsApi.js";
import {notification} from "antd"; import {notification} from "antd";
import {useEffect} from "react"; import {useEffect} from "react";
import {useDispatch, useSelector} from "react-redux"; import {useDispatch, useSelector} from "react-redux";
@ -15,9 +15,9 @@ import {
} from "../../../Redux/Slices/patientsSlice.js"; } from "../../../Redux/Slices/patientsSlice.js";
import dayjs from "dayjs"; import dayjs from "dayjs";
import isBetween from "dayjs/plugin/isBetween"; 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 useHomePage = () => {
const dispatch = useDispatch(); const dispatch = useDispatch();
@ -46,7 +46,7 @@ const useHomePage = () => {
data: patients = [], data: patients = [],
isLoading: isLoadingPatients, isLoading: isLoadingPatients,
isError: isErrorPatients, isError: isErrorPatients,
} = useGetPatientsQuery(undefined, { } = useGetAllPatientsQuery(undefined, {
pollingInterval: 20000, pollingInterval: 20000,
}); });