Skip to content
Snippets Groups Projects
Verified Commit 60853c4b authored by Lukas Mauß's avatar Lukas Mauß Committed by Lukas Maximilian Kimpel
Browse files

Add addToHistory method which sends user data and current date to api

parent b8b81029
No related merge requests found
......@@ -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(
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment