diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/culture-and-hostnames/modal/culture-and-hostnames-modal.element.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/culture-and-hostnames/modal/culture-and-hostnames-modal.element.ts index 17c54549fb..b03235b7cc 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/culture-and-hostnames/modal/culture-and-hostnames-modal.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/culture-and-hostnames/modal/culture-and-hostnames-modal.element.ts @@ -56,16 +56,17 @@ export class UmbCultureAndHostnamesModalElement extends UmbModalBaseElement< this._languageModel = data.items; } - // Modal - async #handleSave() { this.value = { defaultIsoCode: this._defaultIsoCode, domains: this._domains }; - await this.#documentRepository.updateCultureAndHostnames(this.#unique!, this.value); - this.modalContext?.submit(); + const { error } = await this.#documentRepository.updateCultureAndHostnames(this.#unique!, this.value); + + if (!error) { + this._submitModal(); + } } #handleCancel() { - this.modalContext?.reject(); + this._rejectModal(); } // Events diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/culture-and-hostnames/repository/culture-and-hostnames.repository.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/culture-and-hostnames/repository/culture-and-hostnames.repository.ts index 9921c5d58e..312b553b27 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/culture-and-hostnames/repository/culture-and-hostnames.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/culture-and-hostnames/repository/culture-and-hostnames.repository.ts @@ -1,43 +1,20 @@ import { UmbDocumentCultureAndHostnamesServerDataSource } from './culture-and-hostnames.server.data.js'; -import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api'; -import { UMB_NOTIFICATION_CONTEXT } from '@umbraco-cms/backoffice/notification'; import type { UmbApi } from '@umbraco-cms/backoffice/extension-api'; import type { UpdateDomainsRequestModel } from '@umbraco-cms/backoffice/external/backend-api'; export class UmbDocumentCultureAndHostnamesRepository extends UmbControllerBase implements UmbApi { #dataSource = new UmbDocumentCultureAndHostnamesServerDataSource(this); - #notificationContext?: typeof UMB_NOTIFICATION_CONTEXT.TYPE; - - constructor(host: UmbControllerHost) { - super(host); - - this.consumeContext(UMB_NOTIFICATION_CONTEXT, (instance) => { - this.#notificationContext = instance; - }); - } - async readCultureAndHostnames(unique: string) { if (!unique) throw new Error('Unique is missing'); - - const { data, error } = await this.#dataSource.read(unique); - if (!error) { - return { data }; - } - return { error }; + return this.#dataSource.read(unique); } async updateCultureAndHostnames(unique: string, data: UpdateDomainsRequestModel) { if (!unique) throw new Error('Unique is missing'); if (!data) throw new Error('Data is missing'); - - const { error } = await this.#dataSource.update(unique, data); - if (!error) { - const notification = { data: { message: `Cultures and hostnames saved` } }; - this.#notificationContext?.peek('positive', notification); - } - return { error }; + return this.#dataSource.update(unique, data); } }