Unassigns events from a category.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function unassignEvents(
categoryId: string,
eventId: Array<string>,
): Promise<void>;
Category ID.
A list of events IDs.
import { categories } from "wix-events.v2";
import { webMethod, Permissions } from "wix-web-module";
import { elevate } from "wix-auth";
const elevatedUnassignEvents = elevate(categories.unassignEvents);
/*
* Sample categoryId value: "6ec293a8-1b47-4337-9c4e-9a6aeb35e66a"
* Sample eventId value: ["4e5e4adb-9778-4171-a9bb-44e27834ac89"]
*/
export const myUnassignEventsFunction = webMethod(
Permissions.Anyone,
async (categoryId, eventId) => {
try {
const unassignedEvents = await elevatedUnassignEvents(
categoryId,
eventId,
);
console.log("Events are unassigned from the category");
return unassignedEvents;
} catch (error) {
console.error(error);
// Handle the error
}
},
);
/* Promise resolves to void */
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.