FarmMapsLib/projects/common/src/fm/services/user.service.ts
Willem Dantuma 9ebce8e0bb
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
Some refactoring
2019-11-05 17:19:33 +01:00

22 lines
572 B
TypeScript

import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { IUser } from '../models/user';
import { HttpClient } from "@angular/common/http";
import { AppConfig } from "../shared/app.config";
@Injectable({
providedIn: 'root',
})
export class UserService {
constructor(public httpClient: HttpClient, public appConfig: AppConfig) {
}
ApiEndpoint() {
return this.appConfig.getConfig("apiEndPoint");
}
getCurrentUser(): Observable<IUser> {
return this.httpClient.get<IUser>(`${this.ApiEndpoint()}/api/v1/currentuser`);
}
}