Skip to content
Snippets Groups Projects
Commit a6a89f73 authored by Tom Käsler's avatar Tom Käsler
Browse files

Fix feedback

remove old class from component and use service for getting the stream of feedback
parent dad80211
Branches
Tags
No related merge requests found
...@@ -3,7 +3,6 @@ import { ActivatedRoute } from '@angular/router'; ...@@ -3,7 +3,6 @@ import { ActivatedRoute } from '@angular/router';
import { AuthenticationService } from '../../../services/http/authentication.service'; import { AuthenticationService } from '../../../services/http/authentication.service';
import { UserRole } from '../../../models/user-roles.enum'; import { UserRole } from '../../../models/user-roles.enum';
import { NotificationService } from '../../../services/util/notification.service'; import { NotificationService } from '../../../services/util/notification.service';
import { RxStompService } from '@stomp/ng2-stompjs';
import { Message } from '@stomp/stompjs'; import { Message } from '@stomp/stompjs';
import { WsFeedbackService } from '../../../services/websockets/ws-feedback.service'; import { WsFeedbackService } from '../../../services/websockets/ws-feedback.service';
...@@ -27,7 +26,6 @@ export class FeedbackBarometerPageComponent implements OnInit { ...@@ -27,7 +26,6 @@ export class FeedbackBarometerPageComponent implements OnInit {
constructor( constructor(
private authenticationService: AuthenticationService, private authenticationService: AuthenticationService,
private notification: NotificationService, private notification: NotificationService,
private rxStompService: RxStompService,
private wsFeedbackService: WsFeedbackService, private wsFeedbackService: WsFeedbackService,
private route: ActivatedRoute, ) { private route: ActivatedRoute, ) {
this.roomId = localStorage.getItem(`roomId`); this.roomId = localStorage.getItem(`roomId`);
...@@ -36,7 +34,7 @@ export class FeedbackBarometerPageComponent implements OnInit { ...@@ -36,7 +34,7 @@ export class FeedbackBarometerPageComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.userRole = this.authenticationService.getRole(); this.userRole = this.authenticationService.getRole();
this.rxStompService.watch(`/topic/${this.roomId}.feedback.stream`).subscribe((message: Message) => { this.wsFeedbackService.getFeedbackStream(this.roomId).subscribe((message: Message) => {
this.parseIncomingMessage(message); this.parseIncomingMessage(message);
}); });
......
...@@ -2,6 +2,8 @@ import { Injectable } from '@angular/core'; ...@@ -2,6 +2,8 @@ import { Injectable } from '@angular/core';
import { WsConnectorService } from '../../services/websockets/ws-connector.service'; import { WsConnectorService } from '../../services/websockets/ws-connector.service';
import { CreateFeedback } from '../../models/messages/create-feedback'; import { CreateFeedback } from '../../models/messages/create-feedback';
import { GetFeedback } from '../../models/messages/get-feedback'; import { GetFeedback } from '../../models/messages/get-feedback';
import { Observable } from 'rxjs';
import { IMessage } from '@stomp/stompjs';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
...@@ -19,4 +21,8 @@ export class WsFeedbackService { ...@@ -19,4 +21,8 @@ export class WsFeedbackService {
this.wsConnector.send(`/backend/queue/${roomId}.feedback.query`, JSON.stringify(getFeedback)); this.wsConnector.send(`/backend/queue/${roomId}.feedback.query`, JSON.stringify(getFeedback));
} }
getFeedbackStream(roomId: string): Observable<IMessage> {
return this.wsConnector.getWatcher(`/topic/${roomId}.feedback.stream`);
}
} }
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