29 lines
751 B
JavaScript
Raw Normal View History

2021-05-06 16:15:22 -05:00
import { useQuery } from '@apollo/client'
2021-06-26 22:09:39 -05:00
import { Invoice } from '../../components/invoice'
import { LnQRSkeleton } from '../../components/lnqr'
2021-05-06 16:15:22 -05:00
import LayoutCenter from '../../components/layout-center'
2021-10-26 15:49:37 -05:00
import { useRouter } from 'next/router'
import { INVOICE } from '../../fragments/wallet'
2021-05-06 16:15:22 -05:00
2021-10-26 15:49:37 -05:00
export default function FullInvoice () {
2021-05-06 16:15:22 -05:00
return (
<LayoutCenter>
2021-10-26 15:49:37 -05:00
<LoadInvoice />
2021-05-06 16:15:22 -05:00
</LayoutCenter>
)
}
2021-10-26 15:49:37 -05:00
function LoadInvoice () {
const router = useRouter()
const { loading, error, data } = useQuery(INVOICE, {
pollInterval: 1000,
variables: { id: router.query.id }
})
2021-05-06 16:15:22 -05:00
if (error) return <div>error</div>
if (!data || loading) {
2021-06-26 22:09:39 -05:00
return <LnQRSkeleton status='loading' />
2021-05-06 16:15:22 -05:00
}
return <Invoice invoice={data.invoice} />
}