1
0
mirror of https://github.com/bitwarden/web synced 2025-12-12 22:33:23 +00:00

add better error handling to tax call (#1666)

This commit is contained in:
Jake Fink
2022-05-11 11:13:42 -04:00
committed by Jacob Fink
parent ec80782d8f
commit e2d9498167

View File

@@ -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) {