diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-03-22 15:51:54 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-03-22 15:51:54 +0100 |
commit | b1794c53ac97d77a16c10ed915336f08cff1e5e3 (patch) | |
tree | 9dd64ee8316e1e60c434a7d0a6dcbace49eb4d6b /client/angular/users/models | |
parent | 13ce1d01c953f0c4fd3b1d714c016f927dc16f66 (diff) | |
download | PeerTube-b1794c53ac97d77a16c10ed915336f08cff1e5e3.tar.gz PeerTube-b1794c53ac97d77a16c10ed915336f08cff1e5e3.tar.zst PeerTube-b1794c53ac97d77a16c10ed915336f08cff1e5e3.zip |
Login in Angular : first draft
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 | 17 |
2 files changed, 21 insertions, 0 deletions
diff --git a/client/angular/users/models/authStatus.ts b/client/angular/users/models/authStatus.ts new file mode 100644 index 000000000..f646bd4cf --- /dev/null +++ b/client/angular/users/models/authStatus.ts | |||
@@ -0,0 +1,4 @@ | |||
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 new file mode 100644 index 000000000..688dfdc80 --- /dev/null +++ b/client/angular/users/models/token.ts | |||
@@ -0,0 +1,17 @@ | |||
1 | export class Token { | ||
2 | access_token: string; | ||
3 | refresh_token: string; | ||
4 | token_type: string; | ||
5 | |||
6 | constructor (hash) { | ||
7 | this.access_token = hash.access_token; | ||
8 | this.refresh_token = hash.refresh_token; | ||
9 | this.token_type = hash.token_type; | ||
10 | } | ||
11 | |||
12 | save() { | ||
13 | localStorage.setItem('access_token', this.access_token); | ||
14 | localStorage.setItem('refresh_token', this.refresh_token); | ||
15 | localStorage.setItem('token_type', this.token_type); | ||
16 | } | ||
17 | } | ||