Services/shows: refactor
This commit is contained in:
parent
8f416cc8b4
commit
0d9b378b8e
1 changed files with 5 additions and 3 deletions
|
|
@ -14,10 +14,12 @@ export class ShowsApiService {
|
|||
|
||||
private readonly url: string = "https://shows.everest.tailscale/api/";
|
||||
private showsEndpoint: string
|
||||
private idEndpoint: string
|
||||
private http: HttpClient = inject(HttpClient);
|
||||
|
||||
constructor() {
|
||||
this.showsEndpoint = this.url + "shows/"
|
||||
this.idEndpoint = this.showsEndpoint + "id/"
|
||||
}
|
||||
|
||||
getShows(): Observable<ShowsApiResponse> {
|
||||
|
|
@ -25,7 +27,7 @@ export class ShowsApiService {
|
|||
}
|
||||
|
||||
getShow(id: string): Observable<ShowsApiIdResponse> {
|
||||
return this.http.get<ShowsApiIdResponse>(this.showsEndpoint + "id/" + id)
|
||||
return this.http.get<ShowsApiIdResponse>(this.idEndpoint + id)
|
||||
}
|
||||
|
||||
sendShow(newShow: Show): Observable<ShowsApiCreation> {
|
||||
|
|
@ -33,10 +35,10 @@ export class ShowsApiService {
|
|||
}
|
||||
|
||||
deleteShw(id: string): Observable<ShowsApiDeletionEdit> {
|
||||
return this.http.delete<ShowsApiDeletionEdit>(this.showsEndpoint + "id/" + id)
|
||||
return this.http.delete<ShowsApiDeletionEdit>(this.idEndpoint + id)
|
||||
}
|
||||
|
||||
updateShow(show: Show): Observable<ShowsApiDeletionEdit> {
|
||||
return this.http.put<ShowsApiDeletionEdit>(this.showsEndpoint + "id/" + show._id, show)
|
||||
return this.http.put<ShowsApiDeletionEdit>(this.idEndpoint + show._id, show)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue