add season service
This commit is contained in:
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]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user