2021-05-06 21:15:22 +00:00
|
|
|
import { useQuery } from '@apollo/client'
|
2021-06-27 03:09:39 +00:00
|
|
|
import { Invoice } from '../../components/invoice'
|
2023-01-18 18:49:20 +00:00
|
|
|
import { QrSkeleton } from '../../components/qr'
|
2023-07-23 15:08:43 +00:00
|
|
|
import { CenterLayout } from '../../components/layout'
|
2021-10-26 20:49:37 +00:00
|
|
|
import { useRouter } from 'next/router'
|
|
|
|
import { INVOICE } from '../../fragments/wallet'
|
2021-05-06 21:15:22 +00:00
|
|
|
|
2023-07-13 03:08:32 +00:00
|
|
|
export default function FullInvoice ({ id }) {
|
2021-10-26 20:49:37 +00:00
|
|
|
const router = useRouter()
|
2023-07-23 15:08:43 +00:00
|
|
|
const { data, error } = useQuery(INVOICE, {
|
2021-10-26 20:49:37 +00:00
|
|
|
pollInterval: 1000,
|
2023-07-23 15:08:43 +00:00
|
|
|
variables: { id: router.query.id },
|
|
|
|
nextFetchPolicy: 'cache-and-network'
|
2021-10-26 20:49:37 +00:00
|
|
|
})
|
2021-05-06 21:15:22 +00:00
|
|
|
|
2023-07-23 15:08:43 +00:00
|
|
|
return (
|
|
|
|
<CenterLayout>
|
|
|
|
{error && <div>{error.toString()}</div>}
|
|
|
|
{data ? <Invoice invoice={data.invoice} /> : <QrSkeleton status='loading' />}
|
|
|
|
</CenterLayout>
|
|
|
|
)
|
2021-05-06 21:15:22 +00:00
|
|
|
}
|