feat: make invoices dynamic

This commit is contained in:
Ali BARIN
2023-03-27 08:22:24 +00:00
parent fd24dbee21
commit 372cdb10d6
5 changed files with 91 additions and 145 deletions

View File

@@ -0,0 +1,18 @@
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
};
}