Commit df599dd7 authored by Lukas Burgey's avatar Lukas Burgey

Add some types

parent ed1d192a
......@@ -96,7 +96,7 @@ export interface StateAPIResult {
user: User;
user_state: UserState;
services: Service[];
error: string;
error?: string;
}
......
......@@ -78,16 +78,18 @@ export class UserService {
subscription.map((message: Message) => {
return message.body;
}).subscribe((body: any) => {
let json = JSON.parse(body);
if (json.message && json.message != '') {
this.snackBar.open(json.message);
this.messages.push(json.message);
}).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);
}
if (json.user_state) {
this.updateUserState(json.user_state);
}
});
}
);
}
private updateUser(newUser: t.User) {
......
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