Commit fea31959 authored by dev0tion's avatar dev0tion

Add status filter to create, recover, history, dashboard and receive components

parent be60ace9
...@@ -34,7 +34,7 @@ export class LoginComponent implements OnInit { ...@@ -34,7 +34,7 @@ export class LoginComponent implements OnInit {
}, },
error => { error => {
this.errorMessage = <any>error; this.errorMessage = <any>error;
if (error.status === 400) { if (error.status > 400) {
alert(this.errorMessage); alert(this.errorMessage);
console.log(this.errorMessage); console.log(this.errorMessage);
} }
......
...@@ -15,7 +15,9 @@ export class CreateComponent { ...@@ -15,7 +15,9 @@ export class CreateComponent {
constructor(private apiService: ApiService) {} constructor(private apiService: ApiService) {}
private newWallet: WalletCreation; private newWallet: WalletCreation;
private responseMessage: string; private responseMessage: string;
private errorMessage: string;
private createWallet(password: string, network: string, folderPath: string, name: string, ) { private createWallet(password: string, network: string, folderPath: string, name: string, ) {
this.newWallet = new WalletCreation(); this.newWallet = new WalletCreation();
...@@ -26,6 +28,18 @@ export class CreateComponent { ...@@ -26,6 +28,18 @@ export class CreateComponent {
this.apiService this.apiService
.createWallet(this.newWallet) .createWallet(this.newWallet)
.subscribe((response: string) => this.responseMessage = response); .subscribe(
response => {
if (response.status === 200){
this.responseMessage = response;
}
},
error => {
if (error.status > 400){
this.errorMessage = error;
console.log(this.errorMessage);
}
}
);
} }
} }
...@@ -10,8 +10,11 @@ import { WalletRecovery } from '../../shared/wallet-recovery' ...@@ -10,8 +10,11 @@ import { WalletRecovery } from '../../shared/wallet-recovery'
export class RecoverComponent implements OnInit { export class RecoverComponent implements OnInit {
constructor(private apiService: ApiService) { } constructor(private apiService: ApiService) { }
private walletRecovery: WalletRecovery; private walletRecovery: WalletRecovery;
private responseBody: string;
private responseMessage: string;
private errorMessage: string;
ngOnInit() { ngOnInit() {
} }
...@@ -26,7 +29,18 @@ export class RecoverComponent implements OnInit { ...@@ -26,7 +29,18 @@ export class RecoverComponent implements OnInit {
this.apiService this.apiService
.recoverWallet(this.walletRecovery) .recoverWallet(this.walletRecovery)
.subscribe((response: string) => this.responseBody = response, .subscribe(
() => console.log("recoverWallet() completed")); response => {
if (response.status === 200) {
this.responseMessage = response;
}
},
error => {
if(error.status > 400) {
this.errorMessage = error;
console.log(this.errorMessage);
}
}
);
} }
} }
\ No newline at end of file
...@@ -21,8 +21,17 @@ export class HistoryComponent { ...@@ -21,8 +21,17 @@ export class HistoryComponent {
private getWalletHistory() { private getWalletHistory() {
this.apiService.getWalletHistory() this.apiService.getWalletHistory()
.subscribe( .subscribe(
response => this.transactions = response.history, response => {
error => this.errorMessage = <any>error if (response.status === 200) {
this.transactions = response.history;
}
},
error => {
if (error.status === 400) {
this.errorMessage = <any>error;
console.log(this.errorMessage);
}
}
); );
} }
} }
...@@ -21,14 +21,19 @@ export class DashboardComponent { ...@@ -21,14 +21,19 @@ export class DashboardComponent {
private getWalletBalance() { private getWalletBalance() {
this.apiService.getWalletBalance() this.apiService.getWalletBalance()
.subscribe( .subscribe(
response => this.balanceResponse = response, response => {
error => this.errorMessage = <any>error, if (response.status === 200) {
() => this.setBalance() this.balanceResponse = response
this.confirmedBalance = this.balanceResponse.confirmed;
this.unconfirmedBalance = this.balanceResponse.unconfirmed;
}
},
error => {
if (error.status > 400) {
this.errorMessage = <any>error;
console.log(this.errorMessage);
}
}
); );
} }
private setBalance() {
this.confirmedBalance = this.balanceResponse.confirmed;
this.unconfirmedBalance = this.balanceResponse.unconfirmed;
}
} }
...@@ -21,8 +21,17 @@ export class ReceiveComponent { ...@@ -21,8 +21,17 @@ export class ReceiveComponent {
private getUnusedReceiveAddresses() { private getUnusedReceiveAddresses() {
this.apiService.getUnusedReceiveAddresses() this.apiService.getUnusedReceiveAddresses()
.subscribe( .subscribe(
response => this.addresses = response.addresses, response => {
error => this.errorMessage = <any>error if (response.status === 200) {
this.addresses = response.addresses;
}
},
error => {
if (error.status > 400) {
this.errorMessage = <any>error;
console.log(this.errorMessage);
}
}
); );
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment