parent
61611ae374
commit
6f49f42f0d
@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FriendsService } from './friends.service';
|
||||
|
||||
describe('FriendsService', () => {
|
||||
let service: FriendsService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(FriendsService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,25 @@
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in new issue