İçeriğe geç
Yuva subscribe hookMenü

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

    Önizleme örnek verilerle çalışır. Ağa da kanala da ihtiyaç duymaz.

    Kurulum

    Bunu bir shadcn projesinde çalıştırın. Dosyalar kendi kodunuzun içine kopyalanır.

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

    Kullanım

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

    Prop'lar

    UseYuvaSubscribeOptions

    PropTür
    server?string
    channel?string
    client?YuvaClient
    identityToken?IdentityTokenSource | null
    lists?string[]

    YuvaSubscribeState

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

    Bağımlılıklar

    Bu öğeyi kurmak aşağıdakileri de ekler.

    npm paketleri