better resilience on notifications and empty polls
This commit is contained in:
parent
568b6014c1
commit
2d6882b1f8
|
@ -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">
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue