Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 96x 46x 46x 70x 28x 4x 4x 4x 4x 2x | import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { Session } from '../interfaces/session.interface'; @Injectable({ providedIn: 'root' }) export class SessionApiService { private pathService = 'api/session'; constructor(private httpClient: HttpClient) { } public all(): Observable<Session[]> { return this.httpClient.get<Session[]>(this.pathService); } public detail(id: string): Observable<Session> { return this.httpClient.get<Session>(`${this.pathService}/${id}`); } public delete(id: string): Observable<any> { return this.httpClient.delete(`${this.pathService}/${id}`); } public create(session: Session): Observable<Session> { return this.httpClient.post<Session>(this.pathService, session); } public update(id: string, session: Session): Observable<Session> { return this.httpClient.put<Session>(`${this.pathService}/${id}`, session); } public participate(id: string, userId: string): Observable<void> { return this.httpClient.post<void>(`${this.pathService}/${id}/participate/${userId}`, null); } public unParticipate(id: string, userId: string): Observable<void> { return this.httpClient.delete<void>(`${this.pathService}/${id}/participate/${userId}`); } } |