feat: marketplaces editor in clients page
This commit is contained in:
25
src/app/clients/hooks/lists/useClientsList.tsx
Normal file
25
src/app/clients/hooks/lists/useClientsList.tsx
Normal file
@ -0,0 +1,25 @@
|
||||
import { useMemo } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import {
|
||||
getClientsOptions,
|
||||
getClientsQueryKey,
|
||||
} from "@/lib/client/@tanstack/react-query.gen";
|
||||
|
||||
type Props = {
|
||||
includeDeleted?: boolean;
|
||||
};
|
||||
|
||||
const useClientsList = (
|
||||
{ includeDeleted = false }: Props = { includeDeleted: false }
|
||||
) => {
|
||||
const { data, refetch } = useQuery(
|
||||
getClientsOptions({ query: { includeDeleted } })
|
||||
);
|
||||
const clients = useMemo(() => data?.items ?? [], [data]);
|
||||
|
||||
const queryKey = getClientsQueryKey();
|
||||
|
||||
return { clients, refetch, queryKey };
|
||||
};
|
||||
|
||||
export default useClientsList;
|
||||
Reference in New Issue
Block a user