stacker.news/pages/invoices/[id].js

23 lines
707 B
JavaScript
Raw Normal View History

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'
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()
const { data, error } = useQuery(INVOICE, {
2021-10-26 20:49:37 +00:00
pollInterval: 1000,
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
return (
<CenterLayout>
{error && <div>{error.toString()}</div>}
{data ? <Invoice invoice={data.invoice} /> : <QrSkeleton status='loading' />}
</CenterLayout>
)
2021-05-06 21:15:22 +00:00
}