Begin to get Hub service ready for http connections

This commit is contained in:
Daniel Krol 2022-05-10 14:59:39 -04:00
parent 1c7854b9ec
commit d0b197c5b0

View file

@ -1,13 +1,20 @@
import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class HubService {
hubEndpoint = `https://${environment.hubHostname}/api/v0`;
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
private rndStr() {
return (Math.random() + 1).toString(16).substring(2);
@ -15,6 +22,7 @@ export class HubService {
// Obviously just a stub for the actual API
public getChannels(xPubs: string[]): any {
return [{
claimId: this.rndStr(),
handle: '@test-' + this.rndStr(),