diff --git a/src/app/room.service.ts b/src/app/room.service.ts index 2a1f4926a91a3c7acbff16643848a1ab70d5a1ee..31582ab76352ba432742a4ca877c7d8424d9c4ae 100644 --- a/src/app/room.service.ts +++ b/src/app/room.service.ts @@ -14,7 +14,9 @@ const httpOptions = { export class RoomService extends ErrorHandlingService { private apiBaseUrl = 'https://arsnova-staging.mni.thm.de/api'; private roomsUrl = '/room'; + private userUrl = '/user'; private findRoomsUrl = '/find'; + private joinDate = new Date(Date.now()); constructor(private http: HttpClient, private authService: AuthenticationService) { @@ -58,6 +60,11 @@ export class RoomService extends ErrorHandlingService { ); } + addToHistory(roomId: string): void { + const connectionUrl = `${ this.apiBaseUrl }${ this.userUrl }/${this.authService.getUser().userId}/roomHistory`; + this.http.post(connectionUrl, { roomId: roomId, lastVisit: this.joinDate.getTime() }, httpOptions).subscribe(r => console.log(r)); + } + getRoomById(id: string): Observable<Room> { const connectionUrl = `${ this.apiBaseUrl }${ this.roomsUrl }/${id}`; return this.http.get<Room>(connectionUrl).pipe(