dispatch event

This commit is contained in:
Mads Rasmussen
2024-03-01 19:14:59 +01:00
parent 95033675c7
commit d1e6e63dcf

View File

@@ -9,6 +9,8 @@ import { UmbBooleanState, UmbObjectState } from '@umbraco-cms/backoffice/observa
import type { UmbContentTypeCompositionModel, UmbContentTypeSortModel } from '@umbraco-cms/backoffice/content-type';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import type { UmbReferenceByUnique } from '@umbraco-cms/backoffice/models';
import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action';
import { UmbReloadTreeItemChildrenRequestEntityActionEvent } from '@umbraco-cms/backoffice/tree';
type EntityType = UmbMediaTypeDetailModel;
export class UmbMediaTypeWorkspaceContext
@@ -147,6 +149,13 @@ export class UmbMediaTypeWorkspaceContext
if (this.getIsNew()) {
if ((await this.structure.create()) === true) {
if (!this.#parent) throw new Error('Parent is not set');
const eventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT);
const event = new UmbReloadTreeItemChildrenRequestEntityActionEvent({
entityType: this.#parent.entityType,
unique: this.#parent.unique,
});
eventContext.dispatchEvent(event);
this.setIsNew(false);
}
} else {