Services/shows: add function to get single show with id
This commit is contained in:
parent
6d185a7eb8
commit
8a2fbcf43e
2 changed files with 11 additions and 0 deletions
6
src/interfaces/shows-api-id-response.ts
Normal file
6
src/interfaces/shows-api-id-response.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import {Show} from './show';
|
||||
|
||||
export interface ShowsApiIdResponse {
|
||||
status: string
|
||||
show: Show
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ import {HttpClient} from '@angular/common/http';
|
|||
import {Observable} from 'rxjs';
|
||||
import {ShowsApiResponse} from '../../interfaces/shows-api-response';
|
||||
import {ShowsApiCreation} from '../../interfaces/shows-api-creation';
|
||||
import {ShowsApiIdResponse} from '../../interfaces/shows-api-id-response';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
|
@ -21,6 +22,10 @@ export class ShowsApiService {
|
|||
return this.http.get<ShowsApiResponse>(this.showsEndpoint)
|
||||
}
|
||||
|
||||
getShow(id: string): Observable<ShowsApiIdResponse> {
|
||||
return this.http.get<ShowsApiIdResponse>(this.showsEndpoint + "id/" + id )
|
||||
}
|
||||
|
||||
sendShow(newShow: {}) {
|
||||
return this.http.post<ShowsApiCreation>(this.showsEndpoint, newShow)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue