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

26 lines
778 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'
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()
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
return (
<CenterLayout>
{error && <div>{error.toString()}</div>}
{data ? <Invoice invoice={data.invoice} /> : <QrSkeleton status='loading' />}
</CenterLayout>
)
2021-05-06 21:15:22 +00:00
}