An event that is triggered when a category is updated.
The onCategoryUpdated()
event handler runs when a category is updated. The received CategoryUpdated
object contains information about the category that was updated.
Note: Backend events don't work when previewing your site.
function wixBlog_onCategoryUpdated(event: CategoryUpdated): void;
Information about the category that was updated.
// Place this code in the events.js file
// of your site's Backend section.
// Add the file if it doesn't exist.
export function wixBlog_onCategoryUpdated(event) {
const categoryId = event.metadata.entityId;
const categoryLabel = event.entity.label;
console.log("Category updated", event);
}
/*
* {
* "metadata":{
* "id":"26b06cb0-d28b-43d3-9c34-a637c217e79a",
* "entityId":"bcf9d83b-ba2f-44e8-ae27-3a9e2b723f54",
* "eventTime":"2022-06-16T15:12:54.599Z",
* "triggeredByAnonymizeRequest":false
* },
* "entity":{
* "_id": "1ea22fce-bc3c-4b78-9422-f0f367f8628e",
* "coverImage": "wix:image://v1/162e66_f6bffd1cd6144ddf87325b82fe8f42ed~mv2.jpg#originWidth=385&originHeight=245",
* "description": "Posts about my winter",
* "displayPosition": 2,
* "label": "winter",
* "language": "en",
* "postCount": 6,
* "rank": 2,
* "slug": "winter-slug"
* "title": "",
* "translationId": "973369ad-0d4b-41f5-a820-1eed7986e0de"
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.