From 2350e29c3944cc021177d26971eea53db7c9e540 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Thu, 2 Feb 2023 16:23:15 +0100 Subject: [PATCH] use document repo --- .../entity-actions/document-trash.entity-action.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/document-trash.entity-action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/document-trash.entity-action.ts index 7bada10a2f..9fc01de4f5 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/document-trash.entity-action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/document-trash.entity-action.ts @@ -1,5 +1,4 @@ -import { UmbTemplateTreeRepository } from '../../../templating/templates/tree/data/template.tree.repository'; -import { UmbTemplateDetailRepository } from '../../../templating/templates/workspace/data/template.detail.repository'; +import { UmbDocumentRepository } from '../repository/document.repository'; import { UmbContextConsumerController } from '@umbraco-cms/context-api'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; import { UmbModalService, UMB_MODAL_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/modal'; @@ -8,14 +7,12 @@ export class TrashDocumentEntityAction { #host: UmbControllerHostInterface; #key: string; #modalService?: UmbModalService; - #documentDetailRepo: UmbTemplateDetailRepository; - #documentTreeRepo: UmbTemplateTreeRepository; + #documentRepository: UmbDocumentRepository; constructor(host: UmbControllerHostInterface, key: string) { this.#host = host; this.#key = key; - this.#documentTreeRepo = new UmbTemplateTreeRepository(this.#host); // TODO: change to document repo - this.#documentDetailRepo = new UmbTemplateDetailRepository(this.#host); // TODO: change to document repo + this.#documentRepository = new UmbDocumentRepository(this.#host); new UmbContextConsumerController(this.#host, UMB_MODAL_SERVICE_CONTEXT_TOKEN, (instance) => { this.#modalService = instance; @@ -23,7 +20,7 @@ export class TrashDocumentEntityAction { } async execute() { - const { data } = await this.#documentTreeRepo.requestItems([this.#key]); + const { data } = await this.#documentRepository.requestTreeItems([this.#key]); if (data) { const item = data[0]; @@ -37,7 +34,7 @@ export class TrashDocumentEntityAction { modalHandler?.onClose().then(({ confirmed }) => { if (confirmed) { - this.#documentDetailRepo.delete(this.#key); + this.#documentRepository.delete(this.#key); } }); }