1
0
mirror of https://github.com/bitwarden/web synced 2025-12-11 05:43:16 +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,10 +73,14 @@ export class TaxInfoComponent {
this.logService.error(e); this.logService.error(e);
} }
} else { } else {
const taxInfo = await this.apiService.getTaxInfo(); try {
if (taxInfo) { const taxInfo = await this.apiService.getTaxInfo();
this.taxInfo.postalCode = taxInfo.postalCode; if (taxInfo) {
this.taxInfo.country = taxInfo.country || "US"; this.taxInfo.postalCode = taxInfo.postalCode;
this.taxInfo.country = taxInfo.country || "US";
}
} catch (e) {
this.logService.error(e);
} }
} }
this.pristine = Object.assign({}, this.taxInfo); this.pristine = Object.assign({}, this.taxInfo);
@@ -86,9 +90,16 @@ export class TaxInfoComponent {
} }
}); });
const taxRates = await this.apiService.getTaxRates(); try {
this.taxRates = taxRates.data; const taxRates = await this.apiService.getTaxRates();
this.loading = false; if (taxRates) {
this.taxRates = taxRates.data;
}
} catch (e) {
this.logService.error(e);
} finally {
this.loading = false;
}
} }
get taxRate() { get taxRate() {