diff options
Diffstat (limited to 'client/angular/users/models')
-rw-r--r-- | client/angular/users/models/authStatus.ts | 4 | ||||
-rw-r--r-- | client/angular/users/models/token.ts | 31 | ||||
-rw-r--r-- | client/angular/users/models/user.ts | 20 |
3 files changed, 0 insertions, 55 deletions
diff --git a/client/angular/users/models/authStatus.ts b/client/angular/users/models/authStatus.ts deleted file mode 100644 index f646bd4cf..000000000 --- a/client/angular/users/models/authStatus.ts +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | export enum AuthStatus { | ||
2 | LoggedIn, | ||
3 | LoggedOut | ||
4 | } | ||
diff --git a/client/angular/users/models/token.ts b/client/angular/users/models/token.ts deleted file mode 100644 index b7872e74a..000000000 --- a/client/angular/users/models/token.ts +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | export class Token { | ||
2 | access_token: string; | ||
3 | refresh_token: string; | ||
4 | token_type: string; | ||
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 | |||
14 | constructor (hash?: any) { | ||
15 | if (hash) { | ||
16 | this.access_token = hash.access_token; | ||
17 | this.refresh_token = hash.refresh_token; | ||
18 | if (hash.token_type === 'bearer') { | ||
19 | this.token_type = 'Bearer'; | ||
20 | } else { | ||
21 | this.token_type = hash.token_type; | ||
22 | } | ||
23 | } | ||
24 | } | ||
25 | |||
26 | save():void { | ||
27 | localStorage.setItem('access_token', this.access_token); | ||
28 | localStorage.setItem('refresh_token', this.refresh_token); | ||
29 | localStorage.setItem('token_type', this.token_type); | ||
30 | } | ||
31 | } | ||
diff --git a/client/angular/users/models/user.ts b/client/angular/users/models/user.ts deleted file mode 100644 index 3367e3bb5..000000000 --- a/client/angular/users/models/user.ts +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | import { Token } from './token'; | ||
2 | |||
3 | export class User { | ||
4 | username: string; | ||
5 | token: Token; | ||
6 | |||
7 | static load(): User { | ||
8 | return new User(localStorage.getItem('username'), Token.load()); | ||
9 | } | ||
10 | |||
11 | constructor (username: string, hash_token: any) { | ||
12 | this.username = username; | ||
13 | this.token = new Token(hash_token); | ||
14 | } | ||
15 | |||
16 | save(): void { | ||
17 | localStorage.setItem('username', this.username); | ||
18 | this.token.save(); | ||
19 | } | ||
20 | } | ||