From f4049b8fe151905e6cb8a0299c7909a788009328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=20K=C3=A4sler?= <tom.kaesler@mni.thm.de> Date: Mon, 20 May 2019 22:09:32 +0200 Subject: [PATCH] Fix feedback remove old class from component and use service for getting the stream of feedback --- .../feedback-barometer-page.component.ts | 4 +--- src/app/services/websockets/ws-feedback.service.ts | 6 ++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/components/shared/feedback-barometer-page/feedback-barometer-page.component.ts b/src/app/components/shared/feedback-barometer-page/feedback-barometer-page.component.ts index 4be55a5e1..a6a036247 100644 --- a/src/app/components/shared/feedback-barometer-page/feedback-barometer-page.component.ts +++ b/src/app/components/shared/feedback-barometer-page/feedback-barometer-page.component.ts @@ -3,7 +3,6 @@ import { ActivatedRoute } from '@angular/router'; import { AuthenticationService } from '../../../services/http/authentication.service'; import { UserRole } from '../../../models/user-roles.enum'; import { NotificationService } from '../../../services/util/notification.service'; -import { RxStompService } from '@stomp/ng2-stompjs'; import { Message } from '@stomp/stompjs'; import { WsFeedbackService } from '../../../services/websockets/ws-feedback.service'; @@ -27,7 +26,6 @@ export class FeedbackBarometerPageComponent implements OnInit { constructor( private authenticationService: AuthenticationService, private notification: NotificationService, - private rxStompService: RxStompService, private wsFeedbackService: WsFeedbackService, private route: ActivatedRoute, ) { this.roomId = localStorage.getItem(`roomId`); @@ -36,7 +34,7 @@ export class FeedbackBarometerPageComponent implements OnInit { ngOnInit() { 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); }); diff --git a/src/app/services/websockets/ws-feedback.service.ts b/src/app/services/websockets/ws-feedback.service.ts index 668095d1c..4061cec98 100644 --- a/src/app/services/websockets/ws-feedback.service.ts +++ b/src/app/services/websockets/ws-feedback.service.ts @@ -2,6 +2,8 @@ import { Injectable } from '@angular/core'; import { WsConnectorService } from '../../services/websockets/ws-connector.service'; import { CreateFeedback } from '../../models/messages/create-feedback'; import { GetFeedback } from '../../models/messages/get-feedback'; +import { Observable } from 'rxjs'; +import { IMessage } from '@stomp/stompjs'; @Injectable({ providedIn: 'root' @@ -19,4 +21,8 @@ export class WsFeedbackService { this.wsConnector.send(`/backend/queue/${roomId}.feedback.query`, JSON.stringify(getFeedback)); } + + getFeedbackStream(roomId: string): Observable<IMessage> { + return this.wsConnector.getWatcher(`/topic/${roomId}.feedback.stream`); + } } -- GitLab