import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { EndpointService } from 'app/endpoint-service';
@Injectable()
export class MyService {
constructor (
private readonly http: HttpClient,
private readonly endpoint: EndpointService,
) {
}
private readonly api = this.endpoint.api;
getInfo () {
return this.http.get(this.api.to('/info'));
}
setOAuth (token: string) {
this.api.auth.OAuth2(token);
}
setJWT (token: string) {
this.api.auth.JWT(token);
}
setBasic (user: string, pass: string) {
this.api.auth.basic(user, pass);
}
}