Merge pull request #1027 from automatisch/hide-invoices-when-empty
fix: hide empty invoices section
This commit is contained in:
@@ -7,6 +7,11 @@ const getInvoices = async (
|
|||||||
context: Context
|
context: Context
|
||||||
) => {
|
) => {
|
||||||
const subscription = await context.currentUser.$relatedQuery('subscription');
|
const subscription = await context.currentUser.$relatedQuery('subscription');
|
||||||
|
|
||||||
|
if (!subscription) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const invoices = await Billing.paddleClient.getInvoices(
|
const invoices = await Billing.paddleClient.getInvoices(
|
||||||
Number(subscription.paddleSubscriptionId)
|
Number(subscription.paddleSubscriptionId)
|
||||||
);
|
);
|
||||||
|
@@ -13,7 +13,9 @@ import useFormatMessage from 'hooks/useFormatMessage';
|
|||||||
|
|
||||||
export default function Invoices() {
|
export default function Invoices() {
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const { invoices } = useInvoices();
|
const { invoices, loading } = useInvoices();
|
||||||
|
|
||||||
|
if (loading || invoices.length === 0) return <React.Fragment />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
Reference in New Issue
Block a user