Commit c4c8e131 authored by dev0tion's avatar dev0tion

Show balance in dashboard

parent 34dcb8ff
...@@ -86,7 +86,7 @@ export class LoginComponent implements OnInit { ...@@ -86,7 +86,7 @@ export class LoginComponent implements OnInit {
if (response.status >= 200 && response.status < 400) { if (response.status >= 200 && response.status < 400) {
let responseMessage = response.json(); let responseMessage = response.json();
this.globalService.setWalletName(walletLoad.name) this.globalService.setWalletName(walletLoad.name)
this.globalService.setCoinType(1); this.globalService.setCoinType(0);
this.router.navigate(['/wallet']); this.router.navigate(['/wallet']);
} }
}, },
......
...@@ -100,6 +100,7 @@ export class ApiService { ...@@ -100,6 +100,7 @@ export class ApiService {
let params: URLSearchParams = new URLSearchParams(); let params: URLSearchParams = new URLSearchParams();
params.set('walletName', data.walletName); params.set('walletName', data.walletName);
params.set('coinType', data.coinType.toString()); params.set('coinType', data.coinType.toString());
params.set('accountName', "account 0"); //temporary
return this.http return this.http
.get(this.webApiUrl + '/wallet/address', new RequestOptions({headers: this.headers, search: params})) .get(this.webApiUrl + '/wallet/address', new RequestOptions({headers: this.headers, search: params}))
......
...@@ -27,8 +27,8 @@ export class DashboardComponent { ...@@ -27,8 +27,8 @@ export class DashboardComponent {
response => { response => {
if (response.status >= 200 && response.status < 400) { if (response.status >= 200 && response.status < 400) {
this.balanceResponse = response.json(); this.balanceResponse = response.json();
this.confirmedBalance = this.balanceResponse.confirmed; this.confirmedBalance = this.balanceResponse.balances[0].amountConfirmed;
this.unconfirmedBalance = this.balanceResponse.unconfirmed; this.unconfirmedBalance = this.balanceResponse.balances[0].amountUnconfirmed;
} }
}, },
error => { error => {
......
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'; import { WalletInfo } from '../../shared/classes/wallet-info';
...@@ -11,19 +12,18 @@ import { WalletInfo } from '../../shared/classes/wallet-info'; ...@@ -11,19 +12,18 @@ import { WalletInfo } from '../../shared/classes/wallet-info';
}) })
export class ReceiveComponent { export class ReceiveComponent {
constructor(private apiService: ApiService) {} constructor(private apiService: ApiService, private globalService: GlobalService) {}
private address: any; private address: any;
private errorMessage: string; private errorMessage: string;
private walletInfo: WalletInfo;
ngOnInit() { ngOnInit() {
this.getUnusedReceiveAddresses(); this.getUnusedReceiveAddresses();
} }
private getUnusedReceiveAddresses() { private getUnusedReceiveAddresses() {
this.walletInfo = new WalletInfo("Test", 0, "Test") let walletInfo = new WalletInfo(this.globalService.getWalletName(), this.globalService.getCoinType())
this.apiService.getUnusedReceiveAddress(this.walletInfo) this.apiService.getUnusedReceiveAddress(walletInfo)
.subscribe( .subscribe(
response => { response => {
if (response.status >= 200 && response.status < 400) { if (response.status >= 200 && response.status < 400) {
......
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