diff --git a/src/app/items/item-list/item-list.component.html b/src/app/items/item-list/item-list.component.html index cb1cd22..5e8f976 100644 --- a/src/app/items/item-list/item-list.component.html +++ b/src/app/items/item-list/item-list.component.html @@ -6,8 +6,8 @@ {{item.name}}

{{item.cost | currency: getCurrency() }}

-

{{(item.cost/price) | number: '1.0-6'}}

-

ⓩ {{(item.cost/price)*100000000 | number: '1.0-0'}}

+

{{(item.cost/zecPrice) | number: '1.0-6'}}

+

ⓩ {{(item.cost/zecPrice)*100000000 | number: '1.0-0'}}

diff --git a/src/app/items/item-list/item-list.component.ts b/src/app/items/item-list/item-list.component.ts index 71343c9..edc7136 100644 --- a/src/app/items/item-list/item-list.component.ts +++ b/src/app/items/item-list/item-list.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, Input } from '@angular/core'; import { MatDialog, MatDialogConfig} from '@angular/material/dialog'; import { Observable } from 'rxjs'; import { Item } from '../item.model'; @@ -19,6 +19,10 @@ import { ItemAddComponent } from '../item-add/item-add.component'; }) export class ItemListComponent implements OnInit{ + + @Input() + zecPrice: number = 1; + public items: Item[] = []; owner: Owner = { _id: '', @@ -45,10 +49,8 @@ export class ItemListComponent implements OnInit{ expiration: new Date(Date.now()).toISOString(), viewkey: '' }; - public price: number = 1; public ownerUpdate: Observable; public itemsUpdate: Observable; - public priceUpdate: Observable; constructor( public itemService: ItemService, @@ -59,18 +61,13 @@ export class ItemListComponent implements OnInit{ ) { this.ownerUpdate = userService.ownerUpdate; this.itemsUpdate = itemService.itemsUpdated; - this.priceUpdate = fullnodeService.priceUpdate; this.ownerUpdate.subscribe((owner) => { this.owner = owner; - fullnodeService.getPrice(this.owner.currency); itemService.getItems(this.owner.address); this.itemsUpdate.subscribe((items) => { this.items = items; }); }); - this.priceUpdate.subscribe((price) => { - this.price = price; - }); } ngOnInit(){ diff --git a/src/app/viewer/viewer.component.html b/src/app/viewer/viewer.component.html index aa272e5..6172894 100644 --- a/src/app/viewer/viewer.component.html +++ b/src/app/viewer/viewer.component.html @@ -14,7 +14,7 @@
- +
diff --git a/src/app/viewer/viewer.component.ts b/src/app/viewer/viewer.component.ts index 5056177..420dfb0 100644 --- a/src/app/viewer/viewer.component.ts +++ b/src/app/viewer/viewer.component.ts @@ -52,9 +52,11 @@ export class ViewerComponent implements OnInit { expiration: new Date(Date.now()).toISOString(), viewkey: '' }; + public price: number = 1; public addrUpdate: Observable; public ownerUpdate: Observable; public userUpdate: Observable; + public priceUpdate: Observable; orientation: boolean = false; constructor( @@ -65,6 +67,7 @@ export class ViewerComponent implements OnInit { ){ this.addrUpdate = fullnodeService.addrUpdate; this.ownerUpdate = userService.ownerUpdate; + this.priceUpdate = fullnodeService.priceUpdate; this.ownerUpdate.subscribe((owner) => { this.owner = owner; }); @@ -72,6 +75,9 @@ export class ViewerComponent implements OnInit { this.userUpdate.subscribe((user) => { this.user = user; }); + this.priceUpdate.subscribe((price) => { + this.price = price; + }); } ngOnInit(){