diff --git a/frontend/src/app/core/services/season.service.ts b/frontend/src/app/core/services/season.service.ts new file mode 100644 index 0000000..7cb1977 --- /dev/null +++ b/frontend/src/app/core/services/season.service.ts @@ -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( + `${this.backend_apiUrl}/${this.apiAction}/${id}` + ); + } + + markSeasonAsSeen(id: number) { + return this.http.post( + `${this.backend_apiUrl}/${this.apiAction}/${id}/seen`, + [null] + ); + } +}