Search...
publishDraftEvent( )
Publishes a draft event to your live site. Once published, the event's status changes from DRAFT
to UPCOMING.
Description
It's impossible to revert the DRAFT
status after publishing. The only option is to clone the event, and then delete the original one.
Admin Method
This function requires elevated permissions to run. This function is not universal and runs only on the backend.
Syntax
function publishDraftEvent(eventId: string, options: PublishDraftEventOptions): Promise<PublishDraftEventResponse>
publishDraftEvent Parameters
NAME
TYPE
DESCRIPTION
eventId
string
Event ID.
options
Optional
PublishDraftEventOptions
Optional fields.
Returns
Return Type:
Promise<
PublishDraftEventResponse
>NAME
TYPE
DESCRIPTION
event
V3Event
Published event.
Was this helpful?
publishDraftEvent example
Copy Code
1import { wixEventsV2 } from 'wix-events.v2';23 async function publishDraftEvent(eventId, options) {4 try {5 const result = await wixEventsV2.publishDraftEvent(eventId, options);67 return result;8 } catch (error) {9 console.error(error);10 // Handle the error11 }12 }13