import { Injectable , Inject } from '@angular/core' ; import { Observable } from 'rxjs' ; import { HttpClient , HttpHeaders } from '@angular/common/http' ; @ Injectable ( ) export class ProfileService { baseUrl : string ; constructor ( private http , @ Inject ( 'BASE_URL' ) baseUrl ) { this . baseUrl = baseUrl ; } getUserProfile ( ) { return this . http . get ( `${ this . baseUrl }/api/user/settings` ) ; } updateUserProfile ( userObj ) { const userInfo = JSON . stringify ( userObj ) ; const headers = new HttpHeaders ( { Accept : 'application/json' , 'Content-Type' : 'application/json' } ) ; return this . http . post ( `/api/user/update` , userInfo , { headers , responseType : 'text' } ) ; } }