import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { environment } from '../../../environments/environment'; @Injectable({ providedIn: 'root' }) export class FriendsService { private apiURL = environment.apiURL; private token = localStorage.getItem('auth_token'); constructor(private http: HttpClient) { } getFriend(){ const url = `${this.apiURL}/friends`; const headers = new HttpHeaders({ 'Content-Type': 'application/json', Authorization: 'Bearer ' + this.token, }); return this.http.get(url); } }