|
|
|
|
@ -48,11 +48,11 @@ const enrichParamsWithRegionFilter = (params, region) => {
|
|
|
|
|
return resultParams;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const getPoints = async (params, region, dbTable = "placement_points") => {
|
|
|
|
|
export const getPoints = async (params, region, dbTable = "placement_points", signal) => {
|
|
|
|
|
const resultParams = enrichParamsWithRegionFilter(params, region);
|
|
|
|
|
|
|
|
|
|
const { data } = await api.get(
|
|
|
|
|
`/api/${dbTable}/?${resultParams.toString()}`
|
|
|
|
|
`/api/${dbTable}/?${resultParams.toString()}`, {signal}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|
@ -106,19 +106,20 @@ export const useGetTotalInitialPointsCount = () => {
|
|
|
|
|
const { updateCounter } = useUpdateLayerCounter();
|
|
|
|
|
return useQuery(
|
|
|
|
|
["all-initial-count", dbTable, updateCounter],
|
|
|
|
|
async () => {
|
|
|
|
|
async ({signal}) => {
|
|
|
|
|
const params = new URLSearchParams({
|
|
|
|
|
page: 1,
|
|
|
|
|
page_size: 1,
|
|
|
|
|
});
|
|
|
|
|
params.append("status[]", STATUSES.pending);
|
|
|
|
|
|
|
|
|
|
return await getPoints(params, null, dbTable);
|
|
|
|
|
return await getPoints(params, null, dbTable, signal);
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
select: (data) => data.count,
|
|
|
|
|
refetchOnWindowFocus: false,
|
|
|
|
|
refetchOnMount: false }
|
|
|
|
|
refetchOnMount: false
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -158,10 +159,10 @@ export const useGetFilteredPendingPointsCount = (isMerge) => {
|
|
|
|
|
|
|
|
|
|
return useQuery(
|
|
|
|
|
["filtered-points", filters, dbTable, includedIds, updateCounter],
|
|
|
|
|
async () => {
|
|
|
|
|
async ({signal}) => {
|
|
|
|
|
const params = isMerge ? getMergeParams() : getParams();
|
|
|
|
|
|
|
|
|
|
return await getPoints(params, region, dbTable);
|
|
|
|
|
return await getPoints(params, region, dbTable, signal);
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
select: (data) => data.count,
|
|
|
|
|
|