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

Change handling of live updates

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