From 887f77a05f2c3ea5536c56466b09084f61e618ab Mon Sep 17 00:00:00 2001 From: Lukas Kimpel <lukas.kimpel@mni.thm.de> Date: Wed, 14 Mar 2018 10:53:11 +0100 Subject: [PATCH] Clean up AuthenticationInterceptor Add getter/setter for AuthenticationService Create new getter for CreatorRooms --- src/app/authentication.interceptor.ts | 2 ++ src/app/room.service.ts | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/app/authentication.interceptor.ts b/src/app/authentication.interceptor.ts index 071cba6ae..98b085c4e 100644 --- a/src/app/authentication.interceptor.ts +++ b/src/app/authentication.interceptor.ts @@ -8,6 +8,8 @@ import { Observable } from 'rxjs/Observable'; const AUTH_HEADER_KEY = 'Arsnova-Auth-Token'; +const AUTH_HEADER_KEY = 'Arsnova-Auth-Token'; + @Injectable() export class AuthenticationInterceptor implements HttpInterceptor { diff --git a/src/app/room.service.ts b/src/app/room.service.ts index 1c9f0c68b..b48f9dcec 100644 --- a/src/app/room.service.ts +++ b/src/app/room.service.ts @@ -14,7 +14,8 @@ const httpOptions = { export class RoomService extends ErrorHandlingService { private roomsUrl = 'api/rooms'; - constructor(private http: HttpClient) { + constructor(private http: HttpClient, + private authenticationService: AuthenticationService) { super(); } @@ -25,6 +26,17 @@ export class RoomService extends ErrorHandlingService { ); } + getRoomsCreator(): Observable<Room[]> { + const getRoomsUrl = 'https://arsnova-staging.mni.thm.de/api/room/find'; + + return this.http.post<Room[]>(getRoomsUrl, { + properties: {}, + externalFilters: { + ownerId: this.authenticationService.getUser().userId + } + }, httpOptions); + } + addRoom(room: Room): Observable<Room> { return this.http.post<Room>(this.roomsUrl, room, httpOptions).pipe( tap(_ => ''), -- GitLab