Skip to main content

Overview

useUpdateEvent returns a callable that edits an event. Host-only (403 event/forbidden): the logged-in user must be the owner or in hostIds, and, for an event in a space, an active member of that space who isn’t banned in it or a space above it (403 event/not-space-member). The space’s admins and moderators can’t edit events they don’t host. The changes go next to eventId; hostIds, status, and spaceId are not editable here. Pass coverFile to replace the cover, images and files to append to the event’s files, and removeFileIds to remove the event’s files (list files and/or the cover). Uploads send multipart/form-data; any file operation requires the files-images bundle.

Usage Example

Parameters

string
required
The event to update.
The changes go next to eventId, all optional, not inside an update object (an update key throws a SublayError before anything is sent).
The event’s mutable fields, as on Update Event.
string | Date
An ISO 8601 datetime in UTC, or a Date (sent as its ISO string).
{ latitude: number; longitude: number }
New coordinates.
{ file: UploadFileInput; options: UploadImageOptions }
New cover image and its processing options (mode is required) — replaces the existing cover, whose file is deleted. file is a File or Blob, or a React Native file { uri, name, type? }. Sends multipart.
{ files: UploadFileInput[]; options: UploadImageOptions }
Images to append after the event’s existing files, processed into sizes per options (mode is required). A request takes at most 20 files in all. Sends multipart.
{ files: UploadFileInput[]; options?: { pathParts?: string[] } }
Files to append after the event’s existing files, stored as uploaded. Sends multipart.
"files" | "files"[]
What the response adds: "files", the event’s files as they now are (cover first) and the host’s avatar and banner files. Defaults to "files" when the update uploads or removes files; otherwise the response has no files, and the event’s cached files (in useEvent) are kept.
string[]
Ids of the event’s files to remove: list files and/or the cover (coverImageId; removing it clears the cover). Works alone or with uploads. Any other id refuses the whole update (400 event/invalid-remove-file-ids).

Returns

Returns a Promise<Event> — the updated Event.

See Also