add season service

This commit is contained in:
X4Lo committed 2024-04-16 19:01:21 +01:00
1 parent 38682b68da
commit 15e7ec7479
1 file changed
+27
@@ -0,0 +1,27 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Season } from '../../shared/models/season.model';
@Injectable({
providedIn: 'root',
})
export class SeasonService {
private backend_apiUrl = 'http://localhost:4000/api/v1';
private apiAction = 'seasons';
constructor(private http: HttpClient) {}
// get season by id
getSeasonById(id: number) {
return this.http.get<Season>(
`${this.backend_apiUrl}/${this.apiAction}/${id}`
);
}
markSeasonAsSeen(id: number) {
return this.http.post<any>(
`${this.backend_apiUrl}/${this.apiAction}/${id}/seen`,
[null]
);
}
}