Skip to content
Snippets Groups Projects
Commit bee78b73 authored by Hagen Dreßler's avatar Hagen Dreßler
Browse files

Fix app-routing

parent d0ba9e5c
No related merge requests found
......@@ -44,7 +44,7 @@ const routes: Routes = [
canActivate: [AuthenticationGuard],
data: { roles: [UserRole.CREATOR] }
},
{ path: 'room/:roomId/create-comment',
{ path: 'participant/room/:roomId/create-comment',
component: CreateCommentComponent,
canActivate: [AuthenticationGuard],
data: { roles: [UserRole.PARTICIPANT] }
......
......@@ -46,7 +46,7 @@ export class CreateCommentComponent implements OnInit {
body: body,
creationTimestamp: new Date(Date.now())
} as Comment).subscribe(room => {
this.router.navigate([`room/${this.room.id}`]);
this.router.navigate([`/participant/room/${this.room.id}`]);
this.notification.show(`Comment '${subject}' successfully created.`);
});
}
......
......@@ -14,10 +14,10 @@
</mat-card-content>
<mat-divider></mat-divider>
<mat-card-actions>
<button mat-icon-button color="primary" matTooltip="Ask something" routerLink="room/{{room.id}}/create-comment">
<button mat-icon-button color="primary" matTooltip="Ask something">
<mat-icon>question_answer</mat-icon>
</button>
<button mat-icon-button color="primary" matTooltip="Give feedback">
<button mat-icon-button color="primary" matTooltip="Give feedback" routerLink="/participant/room/{{roomId}}/create-comment">
<mat-icon>feedback</mat-icon>
</button>
<button mat-button color="primary" matTooltip="Join question round">
......
......@@ -12,7 +12,7 @@
{{ room.description }}
</p>
<mat-action-row>
<button mat-button routerLink="room/{{ room.id }}">Join room</button>
<button mat-button routerLink="/{{ role }}/room/{{ room.id }}">Join room</button>
</mat-action-row>
</mat-expansion-panel>
</mat-accordion>
import { Component, OnInit } from '@angular/core';
import { Room } from '../room';
import { RoomService } from '../room.service';
import { AuthenticationService} from '../authentication.service';
import {UserRole} from '../user-roles.enum';
@Component({
selector: 'app-room-list',
......@@ -10,12 +12,23 @@ import { RoomService } from '../room.service';
export class RoomListComponent implements OnInit {
rooms: Room[];
closedRooms: Room[];
role: string;
constructor(protected roomService: RoomService) {
}
constructor(
private roomService: RoomService,
protected authenticationService: AuthenticationService) {}
ngOnInit() {
this.getRooms();
this.getPath();
}
getPath() {
if (this.authenticationService.getRole() == UserRole.CREATOR) {
this.role = 'creator';
} else {
this.role = 'participant';
}
}
getRooms(): void {
......
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