Cleaned up Redemptions with use of AsyncPipe & input transformers.
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import { Component, EventEmitter, inject, input, Input, OnInit, Output } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule, Validators } from '@angular/forms';
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import RedeemableAction from '../../shared/models/redeemable-action';
|
||||
|
||||
@Component({
|
||||
@@ -21,20 +20,9 @@ export class ActionDropdownComponent implements OnInit {
|
||||
@Input() action: string | undefined;
|
||||
@Output() readonly actionChange = new EventEmitter<string>();
|
||||
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
|
||||
errorMessageKeys: string[] = []
|
||||
|
||||
|
||||
constructor() {
|
||||
this.route.data.subscribe(data => {
|
||||
if (!data['redeemableActions'])
|
||||
return;
|
||||
|
||||
this.actions = data['redeemableActions'];
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.errorMessageKeys = Object.keys(this.errorMessages);
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ export class ActionsComponent implements OnInit, OnDestroy {
|
||||
ngOnInit(): void {
|
||||
this.route.data.subscribe(data => this._actions = data['redeemableActions'] || []);
|
||||
|
||||
this.subscriptions.push(this.redeemableActionService.delete$?.subscribe(_ => this.redeemableActionService.fetch().subscribe(a => this._actions = a)));
|
||||
this.subscriptions.push(this.redeemableActionService.changes$?.subscribe(a => this._actions = a));
|
||||
|
||||
this.client.fetchRedeemableActions();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user