CustomerType wurde bei existierender Kundenkarte nicht richtig erkannt

This commit is contained in:
Andreas Schickinger
2021-02-03 16:04:07 +01:00
parent bf0c17e640
commit 9d08ae3a00

View File

@@ -24,7 +24,7 @@ export class CustomerDetailsComponent implements OnInit {
customer$: Observable<CustomerDTO>;
customerFeatures$: Observable<KeyValueDTOOfStringAndString[]>;
customerType$: Observable<'store' | 'b2b' | 'webshop' | 'guest'>;
customerType$: Observable<string>;
canAdd$: Observable<boolean>;
canEdit$: Observable<boolean>;
@@ -98,7 +98,10 @@ export class CustomerDetailsComponent implements OnInit {
map((features) => !!features.find((feature) => feature.description === 'Kundenkarte'))
);
this.customerType$ = this.customerFeatures$.pipe(
map((features: KeyValueDTOOfStringAndString[]) => features[0].key as 'store' | 'webshop' | 'b2b' | 'guest')
map(
(features: KeyValueDTOOfStringAndString[]) =>
features.find((f) => f.key === 'store' || f.key === 'webshop' || f.key === 'b2b' || f.key === 'guest')?.key
)
);
this.isB2b$ = this.customerType$.pipe(map((type) => type === 'b2b'));