mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 09:55:06 +03:00
Handle if invoice is null
This commit is contained in:
1 parent
d183d2b5d9
commit
86f3c8d2cf
2 files changed
+16
-2
No files matched your search
@@ -74,7 +74,14 @@ const Invoices: FC<Props> = ({ projectRef }) => {
|
||||
|
||||
const fetchInvoice = async (invoiceId: string) => {
|
||||
const invoice = await get(`${API_URL}/stripe/invoices/${invoiceId}`)
|
||||
window.open(invoice.invoice_pdf, '_blank')
|
||||
if (invoice?.invoice_pdf) {
|
||||
window.open(invoice.invoice_pdf, '_blank')
|
||||
} else {
|
||||
ui.setNotification({
|
||||
category: 'info',
|
||||
message: 'Unable to fetch the selected invoice',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -81,7 +81,14 @@ const InvoicesSettings: FC<Props> = ({ organization }) => {
|
||||
|
||||
const fetchInvoice = async (invoiceId: string) => {
|
||||
const invoice = await get(`${API_URL}/stripe/invoices/${invoiceId}`)
|
||||
window.open(invoice.invoice_pdf, '_blank')
|
||||
if (invoice?.invoice_pdf) {
|
||||
window.open(invoice.invoice_pdf, '_blank')
|
||||
} else {
|
||||
ui.setNotification({
|
||||
category: 'info',
|
||||
message: 'Unable to fetch the selected invoice',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user