Created
January 30, 2022 04:50
-
-
Save touhidrahman/ec6cb2dbf5e2f4b4099e8f291e54abbb to your computer and use it in GitHub Desktop.
Friends API service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { HttpClient } from '@angular/common/http'; | |
import { Injectable } from '@angular/core'; | |
import { environment } from '@environment/environment'; | |
import { Observable } from 'rxjs'; | |
import { Friend } from '../models/friend'; | |
@Injectable({ | |
providedIn: 'root', | |
}) | |
export class FriendApiService { | |
private apiUrl = environment.apiUrl; | |
constructor(private http: HttpClient) {} | |
getFriends(search: string = '', page = 0): Observable<Friend[]> { | |
return this.http.get<Friend[]>(`${this.apiUrl}/friends`, { | |
params: { search, page }, | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment