mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
fix(console): fix manually update tenant open invoice bug (#6747)
This commit is contained in:
parent
f2d280466d
commit
2d3295ea28
1 changed files with 9 additions and 3 deletions
|
@ -21,12 +21,18 @@ function BillingHistory() {
|
|||
const { currentTenantId, updateTenant } = useContext(TenantsContext);
|
||||
const { data: invoices, error } = useInvoices(currentTenantId);
|
||||
const isLoadingInvoices = !invoices && !error;
|
||||
|
||||
const displayInvoices = useMemo(
|
||||
// Don't show draft invoices
|
||||
() => invoices?.filter(({ status }) => status !== 'draft'),
|
||||
[invoices]
|
||||
);
|
||||
|
||||
const openInvoices = useMemo(
|
||||
() => invoices?.filter(({ status }) => status === 'open'),
|
||||
[invoices]
|
||||
);
|
||||
|
||||
const openStripeHostedInvoicePage = useCallback(
|
||||
async (invoiceId: string) => {
|
||||
const { hostedInvoiceUrl } = await cloudApi.get(
|
||||
|
@ -42,12 +48,12 @@ function BillingHistory() {
|
|||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (invoices) {
|
||||
if (openInvoices) {
|
||||
updateTenant(currentTenantId, {
|
||||
openInvoices: invoices,
|
||||
openInvoices,
|
||||
});
|
||||
}
|
||||
}, [currentTenantId, invoices, updateTenant]);
|
||||
}, [currentTenantId, openInvoices, updateTenant]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
|
Loading…
Reference in a new issue