moved explorers call back into currency provider so that explorers data is available when denomination component is instantiated
This commit is contained in:
parent
a345269a8d
commit
87b8319bf3
@ -67,4 +67,4 @@
|
||||
"node": ">=8"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@ -11,7 +11,6 @@ import { ApiProvider } from '../../providers/api/api';
|
||||
export class DenominationComponent {
|
||||
|
||||
public switcherOn: boolean;
|
||||
private explorers: any = [];
|
||||
public units: any = [];
|
||||
|
||||
constructor(
|
||||
@ -20,25 +19,14 @@ export class DenominationComponent {
|
||||
public http: Http,
|
||||
public api: ApiProvider
|
||||
) {
|
||||
|
||||
let url: string = this.api.apiPrefix + 'explorers';
|
||||
this.http.get(url).subscribe(
|
||||
(data) => {
|
||||
this.explorers = JSON.parse(data['_body']);
|
||||
this.switcherOn = true;
|
||||
},
|
||||
(err) => {
|
||||
this.switcherOn = false;
|
||||
console.error('err', err);
|
||||
}
|
||||
);
|
||||
|
||||
this.units = [
|
||||
'USD',
|
||||
this.currencyProvider.defaultCurrency,
|
||||
'm' + this.currencyProvider.defaultCurrency,
|
||||
'bits'
|
||||
];
|
||||
|
||||
this.switcherOn = currencyProvider.explorers.length > 1;
|
||||
}
|
||||
|
||||
public close(): void {
|
||||
|
||||
@ -15,7 +15,7 @@ export class ApiProvider {
|
||||
|
||||
constructor(public http: Http) {
|
||||
// TODO Make this an API call
|
||||
this.apiPrefix = '/insight-api/';
|
||||
this.apiPrefix = '/api/';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -18,11 +18,24 @@ export class CurrencyProvider {
|
||||
private bitstamp: number;
|
||||
private kraken: number;
|
||||
private loading: boolean;
|
||||
public explorers: any = [];
|
||||
|
||||
constructor(public http: Http, private api: ApiProvider) {
|
||||
// TODO Make this an API call
|
||||
this.defaultCurrency = 'BTC';
|
||||
this.currencySymbol = this.defaultCurrency;
|
||||
|
||||
let url: string = this.api.apiPrefix + 'explorers';
|
||||
console.log('exploers url is', url);
|
||||
this.http.get(url).subscribe(
|
||||
(data) => {
|
||||
console.log('', data);
|
||||
this.explorers = JSON.parse(data['_body']);
|
||||
},
|
||||
(err) => {
|
||||
console.error('err', err);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public roundFloat(aFloat: number, decimalPlaces: number): number {
|
||||
|
||||
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "insight",
|
||||
"name": "insight-ui",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "insight",
|
||||
"name": "insight-ui",
|
||||
"description": "A bitcoin block explorer and API.",
|
||||
"version": "1.0.0",
|
||||
"repository": "git://github.com/bitpay/insight.git",
|
||||
@ -10,6 +10,7 @@
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"insight",
|
||||
"insight-ui",
|
||||
"blockchain",
|
||||
"block explorer",
|
||||
"bitcoin",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user