import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' import { Observable } from 'rxjs' import { PaperlessUserProfile } from '../data/user-profile' import { environment } from 'src/environments/environment' @Injectable({ providedIn: 'root', }) export class ProfileService { private endpoint = 'profile' constructor(private http: HttpClient) {} get(): Observable { return this.http.get( `${environment.apiBaseUrl}${this.endpoint}/` ) } update(profile: PaperlessUserProfile): Observable { return this.http.patch( `${environment.apiBaseUrl}${this.endpoint}/`, profile ) } generateAuthToken(): Observable { return this.http.post( `${environment.apiBaseUrl}${this.endpoint}/generate_auth_token/`, {} ) } }