1
0
mirror of https://github.com/mgerb/classic-wow-forums synced 2026-01-11 17:42:48 +00:00

client - wip user account page

This commit is contained in:
2018-01-11 23:59:56 -06:00
parent dc7149eb8b
commit 57663b802c
14 changed files with 303 additions and 19 deletions

View File

@@ -13,11 +13,6 @@ export class UserStore {
});
}
@action setUser(user: UserModel) {
localStorage.setItem('user', JSON.stringify(user));
this.getUserFromStorage();
}
@action private getUserFromStorage(): void {
const u = localStorage.getItem('user');
if (u) {
@@ -25,6 +20,23 @@ export class UserStore {
}
}
@action setUser(user: UserModel) {
localStorage.setItem('user', JSON.stringify(user));
this.getUserFromStorage();
}
@action public setCharacterInfo(info: {[key: string]: string}) {
const { character_avatar, character_class, character_guild, character_name, character_realm } = info;
const user = {...this.user!,
character_avatar,
character_class,
character_guild,
character_name,
character_realm,
};
this.setUser(user);
}
// when the user logs out
@action resetUser() {
this.user = undefined;