Begin to get Hub service ready for http connections
This commit is contained in:
parent
1c7854b9ec
commit
d0b197c5b0
1 changed files with 8 additions and 0 deletions
|
@ -1,13 +1,20 @@
|
||||||
import {Injectable} from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
|
import {HttpClient} from '@angular/common/http';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class HubService {
|
export class HubService {
|
||||||
|
hubEndpoint = `https://${environment.hubHostname}/api/v0`;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
private httpClient: HttpClient,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
|
post(path: string, body: any): Observable<any> {
|
||||||
|
return this.httpClient.post<any>(`${this.hubEndpoint}/${path}`, body);
|
||||||
|
}
|
||||||
|
|
||||||
// Just for stubbing until we get the real thing
|
// Just for stubbing until we get the real thing
|
||||||
private rndStr() {
|
private rndStr() {
|
||||||
return (Math.random() + 1).toString(16).substring(2);
|
return (Math.random() + 1).toString(16).substring(2);
|
||||||
|
@ -15,6 +22,7 @@ export class HubService {
|
||||||
|
|
||||||
// Obviously just a stub for the actual API
|
// Obviously just a stub for the actual API
|
||||||
public getChannels(xPubs: string[]): any {
|
public getChannels(xPubs: string[]): any {
|
||||||
|
|
||||||
return [{
|
return [{
|
||||||
claimId: this.rndStr(),
|
claimId: this.rndStr(),
|
||||||
handle: '@test-' + this.rndStr(),
|
handle: '@test-' + this.rndStr(),
|
||||||
|
|
Loading…
Reference in a new issue