diff options
Diffstat (limited to 'client/app/users/shared/token.model.ts')
-rw-r--r-- | client/app/users/shared/token.model.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/client/app/users/shared/token.model.ts b/client/app/users/shared/token.model.ts index b7872e74a..021c83fad 100644 --- a/client/app/users/shared/token.model.ts +++ b/client/app/users/shared/token.model.ts | |||
@@ -3,7 +3,7 @@ export class Token { | |||
3 | refresh_token: string; | 3 | refresh_token: string; |
4 | token_type: string; | 4 | token_type: string; |
5 | 5 | ||
6 | static load(): Token { | 6 | static load() { |
7 | return new Token({ | 7 | return new Token({ |
8 | access_token: localStorage.getItem('access_token'), | 8 | access_token: localStorage.getItem('access_token'), |
9 | refresh_token: localStorage.getItem('refresh_token'), | 9 | refresh_token: localStorage.getItem('refresh_token'), |
@@ -11,10 +11,11 @@ export class Token { | |||
11 | }); | 11 | }); |
12 | } | 12 | } |
13 | 13 | ||
14 | constructor (hash?: any) { | 14 | constructor(hash?: any) { |
15 | if (hash) { | 15 | if (hash) { |
16 | this.access_token = hash.access_token; | 16 | this.access_token = hash.access_token; |
17 | this.refresh_token = hash.refresh_token; | 17 | this.refresh_token = hash.refresh_token; |
18 | |||
18 | if (hash.token_type === 'bearer') { | 19 | if (hash.token_type === 'bearer') { |
19 | this.token_type = 'Bearer'; | 20 | this.token_type = 'Bearer'; |
20 | } else { | 21 | } else { |
@@ -23,7 +24,7 @@ export class Token { | |||
23 | } | 24 | } |
24 | } | 25 | } |
25 | 26 | ||
26 | save():void { | 27 | save() { |
27 | localStorage.setItem('access_token', this.access_token); | 28 | localStorage.setItem('access_token', this.access_token); |
28 | localStorage.setItem('refresh_token', this.refresh_token); | 29 | localStorage.setItem('refresh_token', this.refresh_token); |
29 | localStorage.setItem('token_type', this.token_type); | 30 | localStorage.setItem('token_type', this.token_type); |