26 lines
778 B
JavaScript
Raw Normal View History

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