From b9d3eea89389d5a14f8dd5e37f58353aad99d6a8 Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Wed, 26 May 2021 10:47:12 +0200 Subject: [PATCH] FIx confirm click. --- .../angular/forms/confirm-click.directive.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/frontend/app/framework/angular/forms/confirm-click.directive.ts b/frontend/app/framework/angular/forms/confirm-click.directive.ts index 2c317ef7c..0cf20d3e4 100644 --- a/frontend/app/framework/angular/forms/confirm-click.directive.ts +++ b/frontend/app/framework/angular/forms/confirm-click.directive.ts @@ -44,20 +44,17 @@ export class ConfirmClickDirective { this.confirmTitle.length > 0 && this.confirmText && this.confirmText.length > 0) { - const observers = [...this.clickConfirmed.observers]; - this.beforeClick.emit(); + const destinations = + this.clickConfirmed.observers?.map(x => (x as Subscriber)['destination']) || []; + this.dialogs.confirm(this.confirmTitle, this.confirmText, this.confirmRememberKey).pipe(take(1)) .subscribe(confirmed => { if (confirmed) { - for (const observer of observers) { - const subscriber = observer as Subscriber; - - const internal = (subscriber as any).destination; - - if (Types.isFunction(internal.next)) { - internal.next(true); + for (const destination of destinations) { + if (Types.isFunction(destination?.next)) { + destination.next(true); } } }