Commit 34dcb8ff authored by dev0tion's avatar dev0tion

History component to real API data

parent 4b6fbd86
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ApiService } from '../../shared/services/api.service' import { ApiService } from '../../shared/services/api.service';
import { GlobalService } from '../../shared/services/global.service';
import { WalletInfo } from '../../shared/classes/wallet-info';
@Component({ @Component({
selector: 'history-component', selector: 'history-component',
...@@ -9,7 +12,7 @@ import { ApiService } from '../../shared/services/api.service' ...@@ -9,7 +12,7 @@ import { ApiService } from '../../shared/services/api.service'
}) })
export class HistoryComponent { export class HistoryComponent {
constructor(private apiService: ApiService) {} constructor(private apiService: ApiService, private globalService: GlobalService) {}
private transactions: any; private transactions: any;
private errorMessage: string; private errorMessage: string;
...@@ -19,11 +22,12 @@ export class HistoryComponent { ...@@ -19,11 +22,12 @@ export class HistoryComponent {
} }
private getWalletHistory() { private getWalletHistory() {
this.apiService.getWalletHistory() let walletInfo = new WalletInfo(this.globalService.getWalletName(), this.globalService.getCoinType())
this.apiService.getWalletHistory(walletInfo)
.subscribe( .subscribe(
response => { response => {
if (response.status >= 200 && response.status < 400) { if (response.status >= 200 && response.status < 400) {
this.transactions = response.json().history; this.transactions = response.json().transactions;
} }
}, },
error => { error => {
......
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