useInvoices

πŸ’΅ Returns all invoices for the current user, including the collection items data associated with every invoice.

🚧

Authentication required to use this hook

The useInvoices hook will call and return a response from the getMyInvoices API.

Hooks Sample Code

...
import useInvoices from "mojito-hooks/useInvoices";

function App {
    const { invoices, isLoading } = useInvoices();

    if(isLoading) return <Loader />;

    if(invoices) return (
        <div>
            {invoices.map((item) => <DrawInvoiceItem item={item} />)}
        </div>
    );

    return <div>No invoices available</div>
}

Parameters

πŸ“˜

This hook doesn't accept any parameters.

Result

PropertyDescriptionType
favoriteItemsMarketplace collection items favored by user.MojitoInvoiceDetails[]
isLoadingDisplay request loading status, provided for convenience.Boolean
errorThe error object for the query, if an error was thrown.Error
refetchA function to manually refetch the query.(options: T) => Promise<U>
queryResultOriginal React-Query query result.QueryResult<T>