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'
|
2021-05-06 21:15:22 +00:00
|
|
|
import LayoutCenter from '../../components/layout-center'
|
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
|
|
|
|
2021-10-26 20:49:37 +00:00
|
|
|
export default function FullInvoice () {
|
2021-05-06 21:15:22 +00:00
|
|
|
return (
|
|
|
|
<LayoutCenter>
|
2021-10-26 20:49:37 +00:00
|
|
|
<LoadInvoice />
|
2021-05-06 21:15:22 +00:00
|
|
|
</LayoutCenter>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2021-10-26 20:49:37 +00:00
|
|
|
function LoadInvoice () {
|
|
|
|
const router = useRouter()
|
|
|
|
const { loading, error, data } = useQuery(INVOICE, {
|
|
|
|
pollInterval: 1000,
|
|
|
|
variables: { id: router.query.id }
|
|
|
|
})
|
2022-11-15 20:51:55 +00:00
|
|
|
if (error) {
|
|
|
|
console.log(error)
|
|
|
|
return <div>error</div>
|
|
|
|
}
|
2021-05-06 21:15:22 +00:00
|
|
|
if (!data || loading) {
|
2023-01-18 18:49:20 +00:00
|
|
|
return <QrSkeleton status='loading' />
|
2021-05-06 21:15:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return <Invoice invoice={data.invoice} />
|
|
|
|
}
|