diff --git a/angular/src/app/services/wp-json.service.ts b/angular/src/app/services/wp-json.service.ts index 20f973c..c45d237 100644 --- a/angular/src/app/services/wp-json.service.ts +++ b/angular/src/app/services/wp-json.service.ts @@ -45,7 +45,8 @@ export class WpJsonService { getCustomerInfo(systemId: string, token: string, url: string): Observable { return this._request(`customer_info/${systemId}/${token}/`, 'GET', null, false, url).pipe( switchMap((response) => { - if (response?.customer_info?.errorCode !== 'Customer_CustomerNotFound') { + // TODO: typescript compile optional chaining ('response?.customer_info?.errorCode') without check ('response.customer_info.errorCode') + if (response && response.customer_info && response.customer_info.errorCode !== 'Customer_CustomerNotFound') { return of(response) } else { return this.newCustomer(systemId, token, url).pipe(