import { getGetServerSideProps } from '@/api/ssrApollo' import { Form, ClientInput, ClientCheckbox, PasswordInput } from '@/components/form' import { CenterLayout } from '@/components/layout' import { WalletButtonBar, WalletCard } from '@/components/wallet-card' import { lnbitsSchema } from '@/lib/validate' import { useLNbits } from '@/components/webln/lnbits' import { WalletSecurityBanner } from '@/components/banners' import WalletLogs from '@/components/wallet-logs' import { Wallet } from '@/lib/constants' import useLocalState from '@/components/use-local-state' import { useMe } from '@/components/me' import { useToast } from '@/components/toast' import { useRouter } from 'next/router' import { Status } from '@/components/webln' export const getServerSideProps = getGetServerSideProps({ authRequired: true }) export default function LNbits () { const me = useMe() const toaster = useToast() const router = useRouter() let storageKey = 'webln:provider:lnbits' if (me) { storageKey = `${storageKey}:${me.id}` } const [config, setConfig, clearConfig] = useLocalState(storageKey) const status = config ? Status.Initialized : undefined return (

LNbits

use LNbits for payments
{ try { await setConfig(values) toaster.success('saved settings') router.push('/settings/wallets') } catch (err) { console.error(err) toaster.danger('failed to attach: ' + err.message || err.toString?.()) } }} > { try { clearConfig() toaster.success('saved settings') router.push('/settings/wallets') } catch (err) { console.error(err) toaster.danger('failed to detach: ' + err.message || err.toString?.()) } }} />
) } export function LNbitsCard () { const { status } = useLNbits() return ( ) }