import { useQuery } from '@apollo/client' import { CenterLayout } from '@/components/layout' import { useRouter } from 'next/router' import { DIRECT } from '@/fragments/wallet' import { SSR, FAST_POLL_INTERVAL } from '@/lib/constants' import Bolt11Info from '@/components/bolt11-info' import { getGetServerSideProps } from '@/api/ssrApollo' import { PrivacyOption } from '../withdrawals/[id]' import { InvoiceExtras } from '@/components/invoice' import { numWithUnits } from '@/lib/format' import Qr, { QrSkeleton } from '@/components/qr' // force SSR to include CSP nonces export const getServerSideProps = getGetServerSideProps({ query: null }) export default function Direct () { return ( ) } export function DirectSkeleton ({ status }) { return ( <>
) } function LoadDirect () { const router = useRouter() const { loading, error, data } = useQuery(DIRECT, SSR ? {} : { variables: { id: router.query.id }, pollInterval: FAST_POLL_INTERVAL, nextFetchPolicy: 'cache-and-network' }) if (error) return
error
if (!data || loading) { return } return ( <>
) }