Instanceof operator was not working so changed the way of checking it
This commit is contained in:
+3
-4
@@ -74,8 +74,7 @@ export class RateContractDetailComponent implements OnInit, AfterViewInit {
|
||||
narration: new FormControl('', { nonNullable: true }),
|
||||
});
|
||||
this.accounts = this.form.controls.account.valueChanges.pipe(
|
||||
map((x) => (x instanceof Account ? x.name : x)),
|
||||
map((x) => (x !== null && x.length >= 1 ? x : null)),
|
||||
map((x) => ((x as Account).name !== undefined ? (x as Account).name : (x as string))),
|
||||
map((x) => (x !== null && x.length >= 1 ? x : null)),
|
||||
debounceTime(150),
|
||||
distinctUntilChanged(),
|
||||
@@ -216,8 +215,8 @@ export class RateContractDetailComponent implements OnInit, AfterViewInit {
|
||||
this.item.date = moment(formModel.date).format('DD-MMM-YYYY');
|
||||
this.item.validFrom = moment(formModel.validFrom).format('DD-MMM-YYYY');
|
||||
this.item.validTill = moment(formModel.validTill).format('DD-MMM-YYYY');
|
||||
if (formModel.account instanceof Account) {
|
||||
this.item.vendor = formModel.account;
|
||||
if (formModel.account !== null && typeof formModel.account !== 'string') {
|
||||
this.item.vendor = formModel.account!;
|
||||
}
|
||||
this.item.narration = formModel.narration!;
|
||||
return this.item;
|
||||
|
||||
Reference in New Issue
Block a user