Skip to main content

Overview

useUpdateEvent returns a callable that edits an event. Host-only. The mutable fields go under update; hostIds, status, and spaceId are not editable here. Pass cover to replace the cover, gallery to append images, and update.removeImageIds to remove existing event images — any image operation sends multipart/form-data and requires the files-images bundle.

Usage Example

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

function EditEvent({ eventId }: { eventId: string }) {
  const updateEvent = useUpdateEvent();

  const handleSave = async (newCover: File) => {
    const event = await updateEvent({
      eventId,
      update: { capacity: 150, description: "Now with more space!" },
      cover: { file: newCover, options: { mode: "original-aspect", sizes: { full: 1600 } } },
    });
    console.log("Updated:", event.id);
  };
}

Parameters

eventId
string
required
The event to update.
update
object
required
The mutable fields to change. All optional: title, description, startTime, endTime, timezone, type, url, venueName, address, location ({ latitude, longitude }), visibility, capacity, allowMaybe, guestListVisible, metadata, and removeImageIds (string[] — File IDs of existing event images to remove).
cover
{ file: File | RNFile; options?: UploadImageOptions }
New cover image — replaces the existing cover. Sends multipart.
Gallery images to append. Sends multipart.

Returns

Returns a Promise<Event> — the updated Event.

See Also