|
|
@@ -68,9 +68,15 @@ export class BcInfoComponent implements HsPanelComponent, OnInit {
|
|
|
}
|
|
|
|
|
|
async refreshUserBalance(): Promise<void> {
|
|
|
- this.getUserBalanceInProgress = true;
|
|
|
- this.userBalance = await this.bcInfoService.getUserBalance(this.user, this.userPrivateKey, this.assetId);
|
|
|
- this.getUserBalanceInProgress = false;
|
|
|
+ try {
|
|
|
+ this.getUserBalanceInProgress = true;
|
|
|
+ this.userBalance = await this.bcInfoService.getUserBalance(this.user, this.userPrivateKey, this.assetId);
|
|
|
+ this.getUserBalanceInProgress = false;
|
|
|
+ }
|
|
|
+ catch (err) {
|
|
|
+ this.getUserBalanceInProgress = false;
|
|
|
+ throw err;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
async refreshPurchaseHistory(): Promise<void> {
|
|
|
@@ -93,26 +99,34 @@ export class BcInfoComponent implements HsPanelComponent, OnInit {
|
|
|
}
|
|
|
|
|
|
async onBuy(): Promise<void> {
|
|
|
- if (!confirm("You sure?")) {
|
|
|
- return;
|
|
|
- }
|
|
|
+ try {
|
|
|
+ if (!confirm("You sure?")) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- this.buyInProgress = true;
|
|
|
+ this.buyInProgress = true;
|
|
|
|
|
|
- let transformedExtent = transformExtent(this.extent, this.mapService.getMap().getView().getProjection(), "EPSG:4326");
|
|
|
- transformedExtent = this.roundExtentCoords(transformedExtent);
|
|
|
- //console.log(transformedExtent);
|
|
|
+ let transformedExtent = transformExtent(this.extent, this.mapService.getMap().getView().getProjection(), "EPSG:4326");
|
|
|
+ console.log(transformedExtent);
|
|
|
+ transformedExtent = this.roundExtentCoords(transformedExtent);
|
|
|
+ //console.log(transformedExtent);
|
|
|
|
|
|
- this.paymentHash = await this.bcInfoService.transferAssets(this.user, this.userPrivateKey, this.assetId, transformedExtent, this.price);
|
|
|
+ this.paymentHash = await this.bcInfoService.transferAssets(this.user, this.userPrivateKey, this.assetId, transformedExtent, this.price);
|
|
|
|
|
|
- await this.bcInfoService.archiveTransfer(this.user, this.price, this.paymentHash, transformedExtent, Date.now());
|
|
|
+ await this.bcInfoService.archiveTransfer(this.user, this.price, this.paymentHash, transformedExtent, Date.now());
|
|
|
|
|
|
- this.refreshPurchaseHistory();
|
|
|
- this.refreshUserBalance();
|
|
|
+ this.refreshPurchaseHistory();
|
|
|
+ this.refreshUserBalance();
|
|
|
+
|
|
|
+ this.dataUrl = await this.bcInfoService.requestData(this.paymentHash, this.user);//"https://eo.lesprojekt.cz/produkty/S2/2020/S2A_MSIL2A_20200422T095031_N9999_R079_T33UXQ_20201127T165009_NDVI.tif"
|
|
|
|
|
|
- this.dataUrl = await this.bcInfoService.requestData(this.paymentHash, this.user);//"https://eo.lesprojekt.cz/produkty/S2/2020/S2A_MSIL2A_20200422T095031_N9999_R079_T33UXQ_20201127T165009_NDVI.tif"
|
|
|
+ this.buyInProgress = false;
|
|
|
+ }
|
|
|
+ catch (err) {
|
|
|
+ this.buyInProgress = false;
|
|
|
+ throw err;
|
|
|
+ }
|
|
|
|
|
|
- this.buyInProgress = false;
|
|
|
}
|
|
|
|
|
|
onCancel(): void {
|