|
|
|
|
@ -1,24 +1,15 @@
|
|
|
|
|
import { useState } from "react";
|
|
|
|
|
import { PAGE_SIZE } from "../constants";
|
|
|
|
|
import { usePointSelection } from "../../../stores/usePointSelection";
|
|
|
|
|
import { useQuery } from "@tanstack/react-query";
|
|
|
|
|
import { getPoints } from "../../../api";
|
|
|
|
|
import { useMergeTableData } from "../useMergeTableData";
|
|
|
|
|
import { STATUSES } from "../../../config";
|
|
|
|
|
import { usePendingPointsFilters } from "../../../stores/usePendingPointsFilters";
|
|
|
|
|
|
|
|
|
|
export const usePendingTableData = (page, resetPage) => {
|
|
|
|
|
const [pageSize, setPageSize] = useState(PAGE_SIZE);
|
|
|
|
|
export const usePendingTableData = (page, resetPage, pageSize, setPageSize) => {
|
|
|
|
|
const { filters } = usePendingPointsFilters();
|
|
|
|
|
const { prediction, categories, region } = filters;
|
|
|
|
|
const {
|
|
|
|
|
selection: { included },
|
|
|
|
|
} = usePointSelection();
|
|
|
|
|
|
|
|
|
|
const includedIds = [...included];
|
|
|
|
|
|
|
|
|
|
const { data, isInitialLoading } = useQuery(
|
|
|
|
|
["table", page, filters, includedIds],
|
|
|
|
|
["table", page, filters],
|
|
|
|
|
async () => {
|
|
|
|
|
const params = new URLSearchParams({
|
|
|
|
|
page,
|
|
|
|
|
@ -26,7 +17,6 @@ export const usePendingTableData = (page, resetPage) => {
|
|
|
|
|
"prediction_current[]": prediction,
|
|
|
|
|
"status[]": [STATUSES.pending],
|
|
|
|
|
"categories[]": categories,
|
|
|
|
|
"included[]": includedIds,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return await getPoints(params, region);
|
|
|
|
|
|