|
|
|
@ -39,29 +39,29 @@ export class SelfService {
|
|
|
|
|
public notLoggedIn(){
|
|
|
|
|
console.log('user was not logged in');
|
|
|
|
|
//do routing
|
|
|
|
|
this.router.navigateByUrl('/login');
|
|
|
|
|
//this.router.navigateByUrl('/login');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public updateUserInfo(response : any){
|
|
|
|
|
const user: User = new User();
|
|
|
|
|
user.loggedIn = true;
|
|
|
|
|
user.userID = response.data.login.id;
|
|
|
|
|
user.username = response.data.login.name;
|
|
|
|
|
user.handle = response.data.login.handle;
|
|
|
|
|
user.email = response.data.login.email;
|
|
|
|
|
user.points = response.data.login.points;
|
|
|
|
|
user.level = response.data.login.level;
|
|
|
|
|
user.friendIDs = response.data.login.friends;
|
|
|
|
|
user.groupIDs = response.data.login.groups;
|
|
|
|
|
user.chatIDs = response.data.login.chats;
|
|
|
|
|
user.requestIDs = response.data.login.requests;
|
|
|
|
|
user.userID = response.data.getSelf.id;
|
|
|
|
|
user.username = response.data.getSelf.name;
|
|
|
|
|
user.handle = response.data.getSelf.handle;
|
|
|
|
|
user.email = response.data.getSelf.email;
|
|
|
|
|
user.points = response.data.getSelf.points;
|
|
|
|
|
user.level = response.data.getSelf.level;
|
|
|
|
|
user.friendIDs = response.data.getSelf.friends;
|
|
|
|
|
user.groupIDs = response.data.getSelf.groups;
|
|
|
|
|
user.chatIDs = response.data.getSelf.chats;
|
|
|
|
|
user.requestIDs = response.data.getSelf.requests;
|
|
|
|
|
|
|
|
|
|
this.data.changeUserInfo(user)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public buildJson(): any {
|
|
|
|
|
const body = {query: `query() {
|
|
|
|
|
getSelf(){id, name, handle, points, level, friends{id}, groups{id},chats{id}}
|
|
|
|
|
const body = {query: `{
|
|
|
|
|
getSelf{id, name,email, handle, points, level, friends{id}, groups{id},chats{id}}
|
|
|
|
|
}`, variables: {
|
|
|
|
|
}};
|
|
|
|
|
return body;
|
|
|
|
|