Skip to content
Snippets Groups Projects
Commit d3446870 authored by Ruben Bimberg's avatar Ruben Bimberg :computer:
Browse files

Fix redirect to question list

[Ticket: #203]
parent ccefd9e1
Branches
Tags
No related merge requests found
...@@ -420,7 +420,7 @@ ...@@ -420,7 +420,7 @@
<button mat-menu-item <button mat-menu-item
*ngIf="user && router.url.endsWith('/quiz')" *ngIf="user && router.url.endsWith('/quiz')"
tabindex="0" tabindex="0"
(click)="goBack()"> (click)="navigateQuestionBoard()">
<mat-icon class="header-icons">forum</mat-icon> <mat-icon class="header-icons">forum</mat-icon>
<span>{{'header.back-to-questionboard' | translate}}</span> <span>{{'header.back-to-questionboard' | translate}}</span>
</button> </button>
......
import { Component, OnInit } from '@angular/core'; import { Component, OnDestroy, OnInit } from '@angular/core';
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'; import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
import { EventService } from '../../../services/util/event.service';
import { Router } from '@angular/router';
@Component({ @Component({
selector: 'app-quiz-now', selector: 'app-quiz-now',
templateUrl: './quiz-now.component.html', templateUrl: './quiz-now.component.html',
styleUrls: ['./quiz-now.component.scss'] styleUrls: ['./quiz-now.component.scss']
}) })
export class QuizNowComponent implements OnInit { export class QuizNowComponent implements OnInit, OnDestroy {
urlSafe: SafeResourceUrl; urlSafe: SafeResourceUrl;
isLoading = true; isLoading = true;
shortId: string;
roleString: string;
private _headerSubscription;
constructor(public sanitizer: DomSanitizer) { constructor(public sanitizer: DomSanitizer,
private router: Router,
private eventService: EventService) {
this.shortId = localStorage.getItem('shortId');
const access = (JSON.parse(localStorage.getItem('ROOM_ACCESS')) || []) as string[];
const roomAccess = access.find(e => e.endsWith('_' + this.shortId)) || '0_' + this.shortId;
const role = parseInt(roomAccess.substr(0, 1), 10);
if (role === 3) {
this.roleString = 'creator';
} else if (role > 0) {
this.roleString = 'moderator';
} else {
this.roleString = 'participant';
}
} }
ngOnInit() { ngOnInit() {
this.urlSafe = this.sanitizer.bypassSecurityTrustResourceUrl('https://staging.antworte.jetzt/'); this.urlSafe = this.sanitizer.bypassSecurityTrustResourceUrl('https://staging.antworte.jetzt/');
this._headerSubscription = this.eventService.on<string>('navigate').subscribe(action => {
if (action === 'questionBoard') {
this.router.navigate(['/' + this.roleString + '/room/' + this.shortId + '/comments']);
}
});
}
ngOnDestroy() {
this._headerSubscription.unsubscribe();
} }
} }
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