add better error handling to tax call (#1666)
This commit is contained in:
parent
da470ad709
commit
dc2078ae58
|
@ -73,11 +73,15 @@ export class TaxInfoComponent {
|
||||||
this.logService.error(e);
|
this.logService.error(e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
try {
|
||||||
const taxInfo = await this.apiService.getTaxInfo();
|
const taxInfo = await this.apiService.getTaxInfo();
|
||||||
if (taxInfo) {
|
if (taxInfo) {
|
||||||
this.taxInfo.postalCode = taxInfo.postalCode;
|
this.taxInfo.postalCode = taxInfo.postalCode;
|
||||||
this.taxInfo.country = taxInfo.country || "US";
|
this.taxInfo.country = taxInfo.country || "US";
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
this.logService.error(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.pristine = Object.assign({}, this.taxInfo);
|
this.pristine = Object.assign({}, this.taxInfo);
|
||||||
// If not the default (US) then trigger onCountryChanged
|
// If not the default (US) then trigger onCountryChanged
|
||||||
|
@ -86,10 +90,17 @@ export class TaxInfoComponent {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
const taxRates = await this.apiService.getTaxRates();
|
const taxRates = await this.apiService.getTaxRates();
|
||||||
|
if (taxRates) {
|
||||||
this.taxRates = taxRates.data;
|
this.taxRates = taxRates.data;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
this.logService.error(e);
|
||||||
|
} finally {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
get taxRate() {
|
get taxRate() {
|
||||||
if (this.taxRates != null) {
|
if (this.taxRates != null) {
|
||||||
|
|
Loading…
Reference in New Issue