Skip to main content

Overview

useRemoveHost returns a callable that removes a user from an event’s hostIds. Host-only. Rejected with event/last-host (409) if the removal would leave the event with no hosts.

Usage Example

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

function RemoveCoHost({ eventId }: { eventId: string }) {
  const removeHost = useRemoveHost();
  return (
    <button onClick={() => removeHost({ eventId, userId: "usr_cohost" })}>
      Remove co-host
    </button>
  );
}

Parameters

eventId
string
required
The event ID.
userId
string
required
The host to remove.

Returns

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

See Also