Skip to main content

Overview

useAddHost returns a callable that adds a user to an event’s hostIds. Host-only — the logged-in user must already be a host. The operation is idempotent.

Usage Example

import { useAddHost } from "@sublay/react-js";

function AddCoHost({ eventId }: { eventId: string }) {
  const addHost = useAddHost();
  return (
    <button onClick={() => addHost({ eventId, userId: "usr_cohost" })}>
      Add co-host
    </button>
  );
}

Parameters

eventId
string
required
The event ID.
userId
string
required
The user to grant host on the event.

Returns

Returns a Promise<Event> — the Event with the new hostIds.

See Also