కంటెంట్‌కు వెళ్ళు
Yuva subscribe hookమెనూ

Yuva subscribe hook

A React hook over the useyuva headless client: the channel's public mailing lists, subscribing from a form with its form token, and the signed-in user's subscriptions with an identity token.

Loading

    ప్రివ్యూ నమూనా డేటాతో నడుస్తుంది. దీనికి నెట్‌వర్క్ లేదా ఛానెల్ అవసరం లేదు.

    ఇన్‌స్టాలేషన్

    దీన్ని shadcn ప్రాజెక్ట్‌లో నడపండి. ఫైళ్లు మీ సొంత కోడ్‌లోకి కాపీ అవుతాయి.

    Shell
    npx shadcn@latest add https://useyuva.com/r/use-yuva-subscribe.json

    వినియోగం

    tsx
    import { useYuvaSubscribe } from "@/hooks/use-yuva-subscribe"
    
    const { lists, states, subscribe, setSubscribed } = useYuvaSubscribe({ server, channel })

    Props

    UseYuvaSubscribeOptions

    Propరకం
    server?string
    channel?string
    client?YuvaClient
    identityToken?IdentityTokenSource | null
    lists?string[]

    YuvaSubscribeState

    Propరకం
    inboxNamestring
    listsClientMailingList[]
    statesRecord<string, SubscriptionState | undefined>
    identifiedboolean
    loadingboolean
    errorunknown
    subscribe(input: YuvaSubscribeInput) => Promise<{ confirmation: boolean }>
    setSubscribed(listId: string, on: boolean, consentText: string) => Promise<SubscriptionState>

    ఆధారపడేవి

    ఈ ఐటమ్‌ను ఇన్‌స్టాల్ చేస్తే కింది వాటిని కూడా జోడిస్తుంది.

    npm ప్యాకేజీలు