Fix for domain forms (#228)

This commit is contained in:
Aleksandra Usacheva 2020-12-11 17:17:32 +03:00 committed by GitHub
parent 0f056768bf
commit 4868e7ca28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 8 deletions

View File

@ -26,8 +26,8 @@ export class FetchContractorService {
])
),
map(([contractID, party]) => {
const contractorID = party.contracts.get(contractID).contractor_id;
return party.contractors.get(contractorID).contractor;
const contractorID = party.contracts.get(contractID)?.contractor_id;
return party.contractors.get(contractorID)?.contractor;
}),
shareReplay(1)
);

View File

@ -4,7 +4,7 @@ import { MatSnackBar } from '@angular/material/snack-bar';
import { Observable } from 'rxjs';
import { tap } from 'rxjs/internal/operators';
import { DomainTypedManager } from '../../../../../thrift-services';
import { DomainCacheService } from '../../../../../thrift-services/damsel/domain-cache.service';
import { BusinessScheduleObject } from '../../../../../thrift-services/damsel/gen-model/domain';
@Component({
@ -24,14 +24,14 @@ export class BusinessScheduleSelectorComponent implements OnInit {
hasError = false;
constructor(private domainManager: DomainTypedManager, private snackBar: MatSnackBar) {}
constructor(private domainCacheService: DomainCacheService, private snackBar: MatSnackBar) {}
selectionChange(change: MatSelectChange) {
this.idChange.emit(change.value);
}
ngOnInit() {
this.schedules$ = this.domainManager.getBusinessScheduleObjects().pipe(
this.schedules$ = this.domainCacheService.getObjects('business_schedule').pipe(
tap(
() => {
this.isLoading = false;

View File

@ -12,7 +12,6 @@ import {
PaymentInstitutionObject,
PaymentInstitutionRef,
} from '../../../../../thrift-services/damsel/gen-model/domain';
import { findDomainObjects } from '../../../../../thrift-services/damsel/operations/utils';
@Component({
selector: 'cc-payment-institution-ref',
@ -39,8 +38,7 @@ export class PaymentInstitutionRefComponent implements OnInit {
) {}
ngOnInit() {
this.paymentInstitutions$ = this.dtm.domain$.pipe(
map((domain) => findDomainObjects(domain, 'payment_institution')),
this.paymentInstitutions$ = this.dtm.getObjects('payment_institution').pipe(
map((paymentInstitutions) =>
sortBy(paymentInstitutions, (paymentInstitution) => paymentInstitution.ref.id)
),