Files
automatisch/packages/web/src/hooks/useInvoices.ee.ts
2023-03-27 08:22:24 +00:00

19 lines
421 B
TypeScript

import { useQuery } from '@apollo/client';
import { TInvoice } from '@automatisch/types';
import { GET_INVOICES } from 'graphql/queries/get-invoices.ee';
type UseInvoicesReturn = {
invoices: TInvoice[],
loading: boolean;
};
export default function useInvoices(): UseInvoicesReturn {
const { data, loading } = useQuery(GET_INVOICES);
return {
invoices: data?.getInvoices || [],
loading: loading
};
}