diff --git a/src/app/participant-room/participant-room.component.ts b/src/app/participant-room/participant-room.component.ts index 2e865692e3023418524b7dc19b7a870811a5871d..5e4ea2bc850f6e88b2e65981f12b40552d80bb42 100644 --- a/src/app/participant-room/participant-room.component.ts +++ b/src/app/participant-room/participant-room.component.ts @@ -3,20 +3,22 @@ import { Room } from '../room'; import { Location } from '@angular/common'; import { RoomService } from '../room.service'; import { ActivatedRoute } from '@angular/router'; +import { RoomComponent } from '../room/room.component'; @Component({ selector: 'app-participant-room', templateUrl: './participant-room.component.html', styleUrls: ['./participant-room.component.scss'] }) -export class ParticipantRoomComponent implements OnInit { +export class ParticipantRoomComponent extends RoomComponent implements OnInit { room: Room; isLoading = true; - constructor(private location: Location, - private roomService: RoomService, - private route: ActivatedRoute) { + constructor(protected location: Location, + protected roomService: RoomService, + protected route: ActivatedRoute) { + super(roomService, route, location); } ngOnInit() { @@ -24,16 +26,4 @@ export class ParticipantRoomComponent implements OnInit { this.getRoom(params['roomId']); }); } - - getRoom(id: string): void { - this.roomService.getRoom(id) - .subscribe(room => { - this.room = room; - this.isLoading = false; - }); - } - - goBack(): void { - this.location.back(); - } } diff --git a/src/app/room/room.component.ts b/src/app/room/room.component.ts index 22379c707e3bb93477f7e47fda0821e4ed3a82c3..a7b06acdaa2498d5f186c7bf52f68fb1d71ba394 100644 --- a/src/app/room/room.component.ts +++ b/src/app/room/room.component.ts @@ -36,4 +36,8 @@ export class RoomComponent implements OnInit { this.roomService.deleteRoom(room).subscribe(); this.location.back(); } + + goBack(): void { + this.location.back(); + } }