#1556 Versand ins Ausland nicht erlauben

This commit is contained in:
Lorenz Hilpert
2021-06-25 16:42:50 +02:00
parent fff90e5bc7
commit a2e706ef07
2 changed files with 14 additions and 3 deletions

View File

@@ -1,3 +1,4 @@
import { HttpErrorResponse } from '@angular/common/http';
import { Component, ChangeDetectionStrategy, OnInit, ChangeDetectorRef } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { ApplicationService, ProcessService } from '@core/application';
@@ -12,11 +13,12 @@ import {
ShippingAddressDTO as CrmShippingAddressDTO,
} from '@swagger/crm';
import { UiMessageModalComponent, UiModalService } from '@ui/modal';
import { isResponseArgs } from '@utils/object';
import { ShippingAddressHelper } from 'apps/domain/crm/src/lib/helpers/shipping-address.helper';
import { HistoryComponent } from 'apps/modal/history/src/lib/history.component';
import { isBoolean } from 'lodash';
import { Observable } from 'rxjs';
import { first, map, shareReplay, switchMap } from 'rxjs/operators';
import { Observable, of } from 'rxjs';
import { catchError, first, map, shareReplay, switchMap } from 'rxjs/operators';
import { CantAddCustomerToCartModalComponent } from '../modals/cant-add-customer-to-cart-modal/cant-add-customer-to-cart.component';
import { CantAddCustomerToCartData } from '../modals/cant-add-customer-to-cart-modal/cant-add-customer-to-cart.data';
import { CantSelectGuestModalComponent } from '../modals/cant-select-guest/cant-select-guest-modal.component';
@@ -204,13 +206,21 @@ export class CustomerDetailsComponent implements OnInit {
shippingAddress: shippingAddress.data,
},
})
.pipe(
catchError((err) => {
if (err instanceof HttpErrorResponse && isResponseArgs(err.error)) {
return of(Object.values(err.error.invalidProperties).join('; ') || err.error.message || err.message);
}
return of(err.message);
})
)
.toPromise();
if (!isBoolean(canAddDestination)) {
this.modal.open({
content: UiMessageModalComponent,
data: {
title: 'Warenkobr kann dem Kunden nicht zugewiesen werden',
title: 'Warenkorb kann dem Kunden nicht zugewiesen werden',
message: canAddDestination,
},
});

View File

@@ -31,6 +31,7 @@ const errorWhiteList: { url: string; codes: number[] }[] = [
{ url: '/payer', codes: [400] },
{ url: '/shippingaddress', codes: [400] },
{ url: '/inventory', codes: [400] },
{ url: '/destination/canadd', codes: [400] },
];
const errorBlackList: { url: string; codes: number[] }[] = [{ url: '/order/checkout', codes: [400] }];