diff --git a/@overflow/noauth-probe/component/noauth-probe-list.component.ts b/@overflow/noauth-probe/component/noauth-probe-list.component.ts index 934ef4b..00a4b15 100644 --- a/@overflow/noauth-probe/component/noauth-probe-list.component.ts +++ b/@overflow/noauth-probe/component/noauth-probe-list.component.ts @@ -1,12 +1,11 @@ import { Component, Input, Output, EventEmitter, AfterContentInit } from '@angular/core'; import { NoAuthProbe } from '@overflow/commons-typescript/model/noauth'; import { ConfirmationService, Message } from 'primeng/primeng'; -import { MessageService } from 'primeng/components/common/messageservice'; @Component({ selector: 'of-noauth-probe-list', templateUrl: './noauth-probe-list.component.html', - providers: [ConfirmationService, MessageService] + providers: [ConfirmationService] }) export class NoAuthProbeListComponent { @Input() noauthProbes: NoAuthProbe[]; @@ -19,7 +18,6 @@ export class NoAuthProbeListComponent { constructor( private confirmationService: ConfirmationService, - private messageService: MessageService ) { } diff --git a/@overflow/noauth-probe/container/noauth-probe-list-container.component.html b/@overflow/noauth-probe/container/noauth-probe-list-container.component.html index 2cfccb0..814ba74 100644 --- a/@overflow/noauth-probe/container/noauth-probe-list-container.component.html +++ b/@overflow/noauth-probe/container/noauth-probe-list-container.component.html @@ -1,3 +1,5 @@ + + ; pending$: Observable; - error$: Observable; + errorSubscription: Subscription; constructor( private store: Store, + private messageService: MessageService, ) { } ngOnInit() { this.pending$ = this.store.pipe(select(NoAuthProbeListContainerSelector.selectPending)); - this.error$ = this.store.pipe(select(NoAuthProbeListContainerSelector.selectError)); + this.errorSubscription = this.store.pipe(select(NoAuthProbeListContainerSelector.selectError)).subscribe( + (e: any) => { + this.messageService.add({severity: 'error', summary: 'Service Message', detail: 'Via MessageService'}); + } + ); this.noauthProbes$ = this.store.pipe(select(NoAuthProbeListContainerSelector.selectAll)).map((_noauthProbes: NoAuthProbe[]) => { if (null === _noauthProbes) { return null; @@ -47,8 +53,12 @@ export class NoAuthProbeListContainerComponent implements OnInit { ); } + ngOnDestroy(): void { + this.errorSubscription.unsubscribe(); + } + accept(noAuthProbe: NoAuthProbe) { - this.store.dispatch(new NoAuthProbeEntityStore.Accept(noAuthProbe.id)); + this.store.dispatch(new NoAuthProbeEntityStore.Accept({aa: noAuthProbe.id} as any)); } deny(noAuthProbe: NoAuthProbe) {