diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-05-11 20:46:45 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-05-13 14:23:11 +0200 |
commit | 881a5e68b64e4acd43408852bbdc914643d8fac6 (patch) | |
tree | bcfd22210ffa44c89043dee65dc7e1a8b320a1b5 | |
parent | 09bc69df7a82ff7c7a3bc4d8c9feef8a64a7c517 (diff) | |
download | PeerTube-881a5e68b64e4acd43408852bbdc914643d8fac6.tar.gz PeerTube-881a5e68b64e4acd43408852bbdc914643d8fac6.tar.zst PeerTube-881a5e68b64e4acd43408852bbdc914643d8fac6.zip |
Fix client linting
-rw-r--r-- | client/angular/users/models/token.ts | 16 | ||||
-rw-r--r-- | client/angular/users/models/user.ts | 8 |
2 files changed, 12 insertions, 12 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); |
diff --git a/client/angular/users/models/user.ts b/client/angular/users/models/user.ts index 2c56a6132..3367e3bb5 100644 --- a/client/angular/users/models/user.ts +++ b/client/angular/users/models/user.ts | |||
@@ -4,15 +4,15 @@ export class User { | |||
4 | username: string; | 4 | username: string; |
5 | token: Token; | 5 | token: Token; |
6 | 6 | ||
7 | static load(): User { | ||
8 | return new User(localStorage.getItem('username'), Token.load()); | ||
9 | } | ||
10 | |||
7 | constructor (username: string, hash_token: any) { | 11 | constructor (username: string, hash_token: any) { |
8 | this.username = username; | 12 | this.username = username; |
9 | this.token = new Token(hash_token); | 13 | this.token = new Token(hash_token); |
10 | } | 14 | } |
11 | 15 | ||
12 | static load(): User { | ||
13 | return new User(localStorage.getItem('username'), Token.load()); | ||
14 | } | ||
15 | |||
16 | save(): void { | 16 | save(): void { |
17 | localStorage.setItem('username', this.username); | 17 | localStorage.setItem('username', this.username); |
18 | this.token.save(); | 18 | this.token.save(); |