models enums services
This commit is contained in:
24
src/app/features/services/review.service.ts
Normal file
24
src/app/features/services/review.service.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { API_URL } from '../../core/tokens/api-url.token';
|
||||
import { Review } from '../../core/models/review.model';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class ReviewService {
|
||||
private http = inject(HttpClient);
|
||||
private apiUrl = inject(API_URL);
|
||||
private readonly endpoint = '/AdminReviews';
|
||||
|
||||
getAll(): Observable<Review[]> {
|
||||
return this.http.get<Review[]>(`${this.apiUrl}${this.endpoint}`);
|
||||
}
|
||||
|
||||
approve(id: string): Observable<void> {
|
||||
return this.http.post<void>(`${this.apiUrl}${this.endpoint}/${id}/approve`, {});
|
||||
}
|
||||
|
||||
delete(id: string): Observable<void> {
|
||||
return this.http.delete<void>(`${this.apiUrl}${this.endpoint}/${id}`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user