From 7bade7caea71aa1dda7b7e4d52d23b5e02a09f8d Mon Sep 17 00:00:00 2001 From: nikolay Date: Tue, 23 May 2023 12:36:10 +0400 Subject: [PATCH] =?UTF-8?q?dev=20#14305=20=D0=98=D0=B7=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B4=D0=B8=D0=B7=D0=B0=D0=B9=D0=BD?= =?UTF-8?q?=D0=B0=20WPA=20=D0=9A=D0=BE=D1=84=D0=B5-=D0=BB=D0=B0=D0=B9?= =?UTF-8?q?=D0=BA=D0=B0:=20fix=20infinity=20loading=20when=20login=20(type?= =?UTF-8?q?script=20error)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- angular/src/app/services/wp-json.service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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(