Commit 84c6388a authored by dev0tion's avatar dev0tion

Adjust dashboard and history to new history structure

parent 37c9ccee
...@@ -29,10 +29,11 @@ ...@@ -29,10 +29,11 @@
<tr *ngFor="let transaction of transactions; let i=index"> <tr *ngFor="let transaction of transactions; let i=index">
<!--<td *ngIf="{{ transaction.amount }} < 0">SENT</td> <!--<td *ngIf="{{ transaction.amount }} < 0">SENT</td>
<td *ngIf="{{ transaction.amount }} > 0">RECEIVED</td>--> <td *ngIf="{{ transaction.amount }} > 0">RECEIVED</td>-->
<td *ngIf="i<5">{{ transaction.type }}</td>
<td *ngIf="i<5">{{ transaction.amount | coinNotation | coinAbbreviation }}</td> <td *ngIf="i<5">{{ transaction.amount | coinNotation | coinAbbreviation }}</td>
<td *ngIf="i<5">{{ transaction.confirmed }}</td> <td *ngIf="i<5">{{ transaction.id }}</td>
<td *ngIf="i<5">{{ transaction.confirmedInBlock }}</td>
<td *ngIf="i<5">{{ transaction.timestamp * 1000 | date:'medium' }}</td> <td *ngIf="i<5">{{ transaction.timestamp * 1000 | date:'medium' }}</td>
<td *ngIf="i<5">{{ transaction.txId }}</td>
</tr> </tr>
</table> </table>
<ng-template #noTransactions>Looks like you haven't made any transactions yet</ng-template> <ng-template #noTransactions>Looks like you haven't made any transactions yet</ng-template>
......
...@@ -17,11 +17,9 @@ import { ReceiveComponent } from '../receive/receive.component'; ...@@ -17,11 +17,9 @@ import { ReceiveComponent } from '../receive/receive.component';
export class DashboardComponent { export class DashboardComponent {
constructor(private apiService: ApiService, private globalService: GlobalService, private modalService: NgbModal) {} constructor(private apiService: ApiService, private globalService: GlobalService, private modalService: NgbModal) {}
private balanceResponse: any;
private confirmedBalance: number; private confirmedBalance: number;
private unconfirmedBalance: number; private unconfirmedBalance: number;
private transactions: any; private transactions: any;
private errorMessage: string;
ngOnInit() { ngOnInit() {
this.getWalletBalance(); this.getWalletBalance();
...@@ -42,15 +40,15 @@ export class DashboardComponent { ...@@ -42,15 +40,15 @@ export class DashboardComponent {
.subscribe( .subscribe(
response => { response => {
if (response.status >= 200 && response.status < 400) { if (response.status >= 200 && response.status < 400) {
this.balanceResponse = response.json(); let balanceResponse = response.json();
this.confirmedBalance = this.balanceResponse.balances[0].amountConfirmed; this.confirmedBalance = balanceResponse.balances[0].amountConfirmed;
this.unconfirmedBalance = this.balanceResponse.balances[0].amountUnconfirmed; this.unconfirmedBalance = balanceResponse.balances[0].amountUnconfirmed;
} }
}, },
error => { error => {
if (error.status >= 400) { if (error.status >= 400) {
this.errorMessage = <any>error; let errorMessage = <any>error;
console.log(this.errorMessage); console.log(errorMessage);
} }
} }
); );
...@@ -62,15 +60,15 @@ export class DashboardComponent { ...@@ -62,15 +60,15 @@ export class DashboardComponent {
.subscribe( .subscribe(
response => { response => {
if (response.status >= 200 && response.status < 400) { if (response.status >= 200 && response.status < 400) {
if (response.json().transactions.length > 0) { if (response.json().transactionsHistory.length > 0) {
this.transactions = response.json().transactions; this.transactions = response.json().transactionHistory;
} }
} }
}, },
error => { error => {
if (error.status >= 400) { if (error.status >= 400) {
this.errorMessage = <any>error; let errorMessage = <any>error;
console.log(this.errorMessage); console.log(errorMessage);
} }
} }
); );
......
...@@ -11,10 +11,11 @@ ...@@ -11,10 +11,11 @@
<tr *ngFor="let transaction of transactions"> <tr *ngFor="let transaction of transactions">
<!--<td *ngIf="{{ transaction.amount }} < 0; else received">SENT</td> <!--<td *ngIf="{{ transaction.amount }} < 0; else received">SENT</td>
<td #received>RECEIVED</td>--> <td #received>RECEIVED</td>-->
<td>{{ transaction.timestamp }}</td> <td>{{ transaction.type }}</td>
<td>{{ transaction.amount | coinNotation | coinAbbreviation }}</td> <td>{{ transaction.amount | coinNotation | coinAbbreviation }}</td>
<td>{{ transaction.confirmed }}</td> <td>{{ transaction.id }}</td>
<td>{{ transaction.txId }}</td> <td>{{ transaction.confirmedInBlock }}</td>
<td>{{ transaction.timestamp * 1000 | date:'medium' }}</td>
</tr> </tr>
</table> </table>
</div> </div>
......
...@@ -27,8 +27,8 @@ export class HistoryComponent { ...@@ -27,8 +27,8 @@ export class HistoryComponent {
.subscribe( .subscribe(
response => { response => {
if (response.status >= 200 && response.status < 400) { if (response.status >= 200 && response.status < 400) {
if (response.json().transactions.length > 0) { if (response.json().transactionsHistory.length > 0) {
this.transactions = response.json().transactions; this.transactions = response.json().transactionsHistory;
} }
} }
}, },
......
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