Passer au contenu
Yuva subscribe hookMenu

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

    L'aperçu utilise des données d'exemple. Il n'a besoin ni de réseau ni de canal.

    Installation

    Exécutez ceci dans un projet shadcn. Les fichiers sont copiés dans votre propre code.

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

    Utilisation

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

    Props

    UseYuvaSubscribeOptions

    PropType
    server?string
    channel?string
    client?YuvaClient
    identityToken?IdentityTokenSource | null
    lists?string[]

    YuvaSubscribeState

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

    Dépendances

    L'installation de cet élément ajoute aussi ce qui suit.

    Paquets npm