diff options
Diffstat (limited to 'client/angular/users/models/token.ts')
-rw-r--r-- | client/angular/users/models/token.ts | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/client/angular/users/models/token.ts b/client/angular/users/models/token.ts index 906bf501b..b7872e74a 100644 --- a/client/angular/users/models/token.ts +++ b/client/angular/users/models/token.ts | |||
@@ -3,6 +3,14 @@ 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 { | ||
7 | return new Token({ | ||
8 | access_token: localStorage.getItem('access_token'), | ||
9 | refresh_token: localStorage.getItem('refresh_token'), | ||
10 | token_type: localStorage.getItem('token_type') | ||
11 | }); | ||
12 | } | ||
13 | |||
6 | constructor (hash?: any) { | 14 | constructor (hash?: any) { |
7 | if (hash) { | 15 | if (hash) { |
8 | this.access_token = hash.access_token; | 16 | this.access_token = hash.access_token; |
@@ -15,14 +23,6 @@ export class Token { | |||
15 | } | 23 | } |
16 | } | 24 | } |
17 | 25 | ||
18 | static load(): Token { | ||
19 | return new Token({ | ||
20 | access_token: localStorage.getItem('access_token'), | ||
21 | refresh_token: localStorage.getItem('refresh_token'), | ||
22 | token_type: localStorage.getItem('token_type') | ||
23 | }); | ||
24 | } | ||
25 | |||
26 | save():void { | 26 | save():void { |
27 | localStorage.setItem('access_token', this.access_token); | 27 | localStorage.setItem('access_token', this.access_token); |
28 | localStorage.setItem('refresh_token', this.refresh_token); | 28 | localStorage.setItem('refresh_token', this.refresh_token); |