Skip to content

Commit

Permalink
temp solution until we support multiple repos
Browse files Browse the repository at this point in the history
  • Loading branch information
madsrasmussen committed Nov 14, 2023
1 parent 03da7f5 commit c19cf92
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/packages/core/entity-action/common/delete/delete.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { UmbDetailRepository, UmbItemRepository } from '@umbraco-cms/backoffice/repository';

export class UmbDeleteEntityAction<
T extends UmbDetailRepository & UmbItemRepository<any>
T extends UmbDetailRepository & UmbItemRepository<any>,
> extends UmbEntityActionBase<T> {
#modalManager?: UmbModalManagerContext;

Expand All @@ -24,20 +24,17 @@ export class UmbDeleteEntityAction<
async execute() {
if (!this.repository || !this.#modalManager) return;

const { data } = await this.repository.requestItems([this.unique]);
// TOOD: add back when entity actions can support multiple repositories
//const { data } = await this.repository.requestItems([this.unique]);

if (data) {
const item = data[0];

const modalContext = this.#modalManager.open(UMB_CONFIRM_MODAL, {
headline: `Delete ${item.name}`,
content: 'Are you sure you want to delete this item?',
color: 'danger',
confirmLabel: 'Delete',
});
const modalContext = this.#modalManager.open(UMB_CONFIRM_MODAL, {
headline: `Delete`,
content: 'Are you sure you want to delete this item?',
color: 'danger',
confirmLabel: 'Delete',
});

await modalContext.onSubmit();
await this.repository?.delete(this.unique);
}
await modalContext.onSubmit();
await this.repository?.delete(this.unique);
}
}

0 comments on commit c19cf92

Please sign in to comment.