aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/auth/auth-user.model.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/auth/auth-user.model.ts')
-rw-r--r--client/src/app/shared/auth/auth-user.model.ts9
1 files changed, 3 insertions, 6 deletions
diff --git a/client/src/app/shared/auth/auth-user.model.ts b/client/src/app/shared/auth/auth-user.model.ts
index bdd5ea5a9..f560351f4 100644
--- a/client/src/app/shared/auth/auth-user.model.ts
+++ b/client/src/app/shared/auth/auth-user.model.ts
@@ -7,9 +7,6 @@ export class AuthUser extends User {
7 USERNAME: 'username' 7 USERNAME: 'username'
8 }; 8 };
9 9
10 id: string;
11 role: string;
12 username: string;
13 tokens: Tokens; 10 tokens: Tokens;
14 11
15 static load() { 12 static load() {
@@ -17,7 +14,7 @@ export class AuthUser extends User {
17 if (usernameLocalStorage) { 14 if (usernameLocalStorage) {
18 return new AuthUser( 15 return new AuthUser(
19 { 16 {
20 id: localStorage.getItem(this.KEYS.ID), 17 id: parseInt(localStorage.getItem(this.KEYS.ID)),
21 username: localStorage.getItem(this.KEYS.USERNAME), 18 username: localStorage.getItem(this.KEYS.USERNAME),
22 role: localStorage.getItem(this.KEYS.ROLE) 19 role: localStorage.getItem(this.KEYS.ROLE)
23 }, 20 },
@@ -35,7 +32,7 @@ export class AuthUser extends User {
35 Tokens.flush(); 32 Tokens.flush();
36 } 33 }
37 34
38 constructor(userHash: { id: string, username: string, role: string }, hashTokens: any) { 35 constructor(userHash: { id: number, username: string, role: string }, hashTokens: any) {
39 super(userHash); 36 super(userHash);
40 this.tokens = new Tokens(hashTokens); 37 this.tokens = new Tokens(hashTokens);
41 } 38 }
@@ -58,7 +55,7 @@ export class AuthUser extends User {
58 } 55 }
59 56
60 save() { 57 save() {
61 localStorage.setItem(AuthUser.KEYS.ID, this.id); 58 localStorage.setItem(AuthUser.KEYS.ID, this.id.toString());
62 localStorage.setItem(AuthUser.KEYS.USERNAME, this.username); 59 localStorage.setItem(AuthUser.KEYS.USERNAME, this.username);
63 localStorage.setItem(AuthUser.KEYS.ROLE, this.role); 60 localStorage.setItem(AuthUser.KEYS.ROLE, this.role);
64 this.tokens.save(); 61 this.tokens.save();