Commit 2c7859c8 authored by Lukas Burgey's avatar Lukas Burgey

Change handling of live updates

parent df599dd7
......@@ -76,18 +76,19 @@ export class UserService {
'/exchange/update/' + this.user.id.toString()
);
subscription.map((message: Message) => {
return message.body;
}).subscribe(
(body: any) => {
let json : t.StateAPIResult = JSON.parse(body);
if (json.error && json.error != '') {
this.snackBar.open(json.error);
this.messages.push(json.error);
subscription.subscribe(
(message: Message) => {
let update : t.StateAPIResult = JSON.parse(message.body);
if (update.error && update.error != '') {
this.snackBar.open(update.error);
this.messages.push(update.error);
}
if (json.user_state) {
this.updateUserState(json.user_state);
if (update.user_state) {
this.updateUserState(update.user_state);
}
},
(error: any) => {
console.log(error)
}
);
}
......@@ -126,7 +127,7 @@ export class UserService {
this.snackBar.open('Logged in');
this.connectLiveUpdates()
this.connectLiveUpdates();
}
if (logout) {
this._logout()
......
Markdown is supported
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