better resilience on notifications and empty polls

This commit is contained in:
Nicolas Constant 2019-07-06 21:47:08 -04:00
parent 568b6014c1
commit 2d6882b1f8
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
3 changed files with 8 additions and 2 deletions

View File

@ -1,4 +1,4 @@
<div class="poll">
<div class="poll" *ngIf="poll">
<div *ngIf="!poll.voted && !poll.expired">
<div *ngFor="let o of options">
<label class="poll__container">

View File

@ -30,6 +30,8 @@ export class PollComponent implements OnInit {
private _poll: Poll;
@Input('poll')
set poll(value: Poll) {
if(!value) return;
this._poll = value;
this.pollName = this.poll.id;

View File

@ -45,7 +45,11 @@ export class StreamingWrapper {
private start(route: string) {
this.eventSource = new WebSocket(route);
this.eventSource.onmessage = x => this.statusParsing(<WebSocketEvent>JSON.parse(x.data));
this.eventSource.onmessage = x => {
if (x.data !== '') {
this.statusParsing(<WebSocketEvent>JSON.parse(x.data));
}
}
this.eventSource.onerror = x => this.webSocketGotError(x);
this.eventSource.onopen = x => { };
this.eventSource.onclose = x => this.webSocketClosed(route, x);