2020-05-02 07:36:35 +02:00
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
import { HttpClient } from '@angular/common/http';
|
|
|
|
import { ReplaySubject } from 'rxjs';
|
|
|
|
import { environment } from 'src/environments/environment';
|
|
|
|
|
|
|
|
@Injectable({
|
|
|
|
providedIn: 'root'
|
|
|
|
})
|
|
|
|
export class AssetsService {
|
|
|
|
network = environment.network;
|
|
|
|
|
|
|
|
assetsMinimal$ = new ReplaySubject<any>(1);
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
private httpClient: HttpClient,
|
|
|
|
) {
|
|
|
|
if (this.network === 'liquid') {
|
|
|
|
this.getAssetsMinimalJson$();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
getAssetsMinimalJson$() {
|
2020-05-02 11:59:14 +02:00
|
|
|
this.httpClient.get('/resources/assets.minimal.json')
|
2020-05-02 07:36:35 +02:00
|
|
|
.subscribe((data) => {
|
|
|
|
this.assetsMinimal$.next(data);
|
|
|
|
});
|
|
|
|
}
|
2020-05-02 11:29:34 +02:00
|
|
|
|
|
|
|
getAssetsJson$() {
|
2020-05-02 11:59:14 +02:00
|
|
|
return this.httpClient.get('/resources/assets.json');
|
2020-05-02 11:29:34 +02:00
|
|
|
}
|
2020-05-02 07:36:35 +02:00
|
|
|
}
|