Import des sources angular à partir de 'headup_app'
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { ApiService } from 'src/app/core/services';
|
||||
import { Profile } from 'src/app/core/models';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class ProfilesService {
|
||||
constructor(
|
||||
private apiService: ApiService
|
||||
) { }
|
||||
|
||||
get(username: string): Observable<Profile> {
|
||||
return this.apiService.get('/profiles/' + username)
|
||||
.pipe(map((data: { profile: Profile }) => data.profile));
|
||||
}
|
||||
|
||||
follow(username: string): Observable<Profile> {
|
||||
return this.apiService.post('/profiles/' + username + '/follow');
|
||||
}
|
||||
|
||||
unfollow(username: string): Observable<Profile> {
|
||||
return this.apiService.delete('/profiles/' + username + '/follow');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user