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'
|
2023-07-31 19:54:30 +00:00
|
|
|
import { SSR } from '../../lib/constants'
|
2021-05-06 21:15:22 +00:00
|
|
|
|
2021-10-26 20:49:37 +00:00
|
|
|
export default function FullInvoice () {
|
|
|
|
const router = useRouter()
|
2023-07-31 19:54:30 +00:00
|
|
|
const { data, error } = useQuery(INVOICE, SSR
|
|
|
|
? {}
|
|
|
|
: {
|
|
|
|
pollInterval: 1000,
|
|
|
|
variables: { id: router.query.id },
|
|
|
|
nextFetchPolicy: 'cache-and-network'
|
|
|
|
})
|
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
|
|
|
}
|