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 {
},
error => {
this.errorMessage = <any>error;
if (error.status === 400) {
if (error.status > 400) {
alert(this.errorMessage);
console.log(this.errorMessage);
}
......
......@@ -15,7 +15,9 @@ export class CreateComponent {
constructor(private apiService: ApiService) {}
private newWallet: WalletCreation;
private responseMessage: string;
private errorMessage: string;
private createWallet(password: string, network: string, folderPath: string, name: string, ) {
this.newWallet = new WalletCreation();
......@@ -26,6 +28,18 @@ export class CreateComponent {
this.apiService
.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'
export class RecoverComponent implements OnInit {
constructor(private apiService: ApiService) { }
private walletRecovery: WalletRecovery;
private responseBody: string;
private responseMessage: string;
private errorMessage: string;
ngOnInit() {
}
......@@ -26,7 +29,18 @@ export class RecoverComponent implements OnInit {
this.apiService
.recoverWallet(this.walletRecovery)
.subscribe((response: string) => this.responseBody = response,
() => console.log("recoverWallet() completed"));
.subscribe(
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 {
private getWalletHistory() {
this.apiService.getWalletHistory()
.subscribe(
response => this.transactions = response.history,
error => this.errorMessage = <any>error
response => {
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 {
private getWalletBalance() {
this.apiService.getWalletBalance()
.subscribe(
response => this.balanceResponse = response,
error => this.errorMessage = <any>error,
() => this.setBalance()
response => {
if (response.status === 200) {
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 {
private getUnusedReceiveAddresses() {
this.apiService.getUnusedReceiveAddresses()
.subscribe(
response => this.addresses = response.addresses,
error => this.errorMessage = <any>error
response => {
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