All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
26 lines
720 B
TypeScript
26 lines
720 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`);
|
|
}
|
|
|
|
updateCurrentUser(user: IUser): Observable<IUser> {
|
|
return this.httpClient.put<IUser>(`${this.ApiEndpoint()}/api/v1/currentuser`, user);
|
|
}
|
|
}
|