Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 7x 529x 925x 529x 529x 529x | import { QKEY_MANAGE_MONEY_TRANSACTIONS_LIST } from "@constants/queryKeys";
import { useAppSelector } from "@redux/hooks";
import { selectFiltersObject } from "@redux/slices/dynamicFilterSlice";
import { DefaultValuesTypeManageMoney } from "@pages/ManageMoney/constants";
import {
customAmountArrayKey,
urlFilterFormat,
} from "@shared/GiveFilter/constants";
import { countNonEmptyValues } from "@shared/GiveFilter/utils";
export const useFormatManageMoneyFilter = (queryKey?: string) => {
const filterObject = useAppSelector((state) =>
selectFiltersObject(state, queryKey ?? QKEY_MANAGE_MONEY_TRANSACTIONS_LIST),
) as DefaultValuesTypeManageMoney;
const filterKey = urlFilterFormat as keyof typeof filterObject;
const filterConst = countNonEmptyValues(filterObject, [
customAmountArrayKey,
urlFilterFormat,
]);
return {
formattedFilterString: (filterObject?.[filterKey] as string) || "",
filterObject,
filterConst,
};
};
|