Refactoring

This commit is contained in:
2026-03-29 23:23:33 +02:00
parent 43d61fcf16
commit 8a602bd2db
124 changed files with 1313 additions and 758 deletions
+6 -5
View File
@@ -1,27 +1,28 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { ApiService } from 'src/app/core/services';
import { Profile } from 'src/app/core/models';
import { ApiService } from '@services';
import { Profile } from '@models';
import { map } from 'rxjs/operators';
@Injectable({ providedIn: 'root' })
export class ProfilesService {
private _apiVersion = '/v2';
constructor(
private apiService: ApiService
) { }
get(username: string): Observable<Profile> {
return this.apiService.get('/profiles/' + username)
return this.apiService.get(`${this._apiVersion}/profiles/${username}`)
.pipe(map((data: { profile: Profile }) => data.profile));
}
follow(username: string): Observable<Profile> {
return this.apiService.post('/profiles/' + username + '/follow');
return this.apiService.post(`${this._apiVersion}/profiles/${username}/follow`);
}
unfollow(username: string): Observable<Profile> {
return this.apiService.delete('/profiles/' + username + '/follow');
return this.apiService.delete(`${this._apiVersion}/profiles/${username}/follow`);
}
}