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

Try to naviate into room after creating

parent 12a4be70
No related merge requests found
......@@ -15,6 +15,7 @@ export class RoomCreationComponent implements OnInit {
shortName: string;
emptyInputs = false;
room: Room;
roomId: string;
constructor(private roomService: RoomService,
private router: Router,
......@@ -41,7 +42,12 @@ export class RoomCreationComponent implements OnInit {
this.emptyInputs = true;
return;
}
this.roomService.addRoom({ name: longRoomName, abbreviation: shortRoomName, description: description } as Room)
this.roomService.addRoom({
name: longRoomName,
abbreviation: shortRoomName,
description: description
} as Room).subscribe( room => this.room = room);
this.roomService.getRoomById(this.roomId)
.subscribe(room => {
this.room = room;
this.notification.show(`Room '${this.room.name}' successfully created.`);
......
......@@ -58,6 +58,13 @@ export class RoomService extends ErrorHandlingService {
);
}
getRoomById(id: string): Observable<Room> {
const connectionUrl = `${ this.apiBaseUrl }${ this.roomsUrl }/${id}`;
return this.http.get<Room>(connectionUrl).pipe(
catchError(this.handleError<Room>(`getRoom id=${id}`))
);
}
updateRoom(room: Room): Observable<Room> {
const connectionUrl = `${this.apiBaseUrl}${this.roomsUrl}/${room.id}`;
return this.http.put(connectionUrl, {
......
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