diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-06-01 20:36:27 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-06-01 20:36:27 +0200 |
commit | a840d396093ef968f9512862197ac166a1ff9921 (patch) | |
tree | f7e4c93ee3ae8a44bd14fd1f7c74234eef7469ef /client/app/users/shared/token.model.ts | |
parent | 575fdcece562b914149f89f5a5b96ab206648f09 (diff) | |
download | PeerTube-a840d396093ef968f9512862197ac166a1ff9921.tar.gz PeerTube-a840d396093ef968f9512862197ac166a1ff9921.tar.zst PeerTube-a840d396093ef968f9512862197ac166a1ff9921.zip |
Add authentication tokens to make friends/quit friends
Diffstat (limited to 'client/app/users/shared/token.model.ts')
-rw-r--r-- | client/app/users/shared/token.model.ts | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/client/app/users/shared/token.model.ts b/client/app/users/shared/token.model.ts deleted file mode 100644 index 021c83fad..000000000 --- a/client/app/users/shared/token.model.ts +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | export class Token { | ||
2 | access_token: string; | ||
3 | refresh_token: string; | ||
4 | token_type: string; | ||
5 | |||
6 | static load() { | ||
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 | |||
19 | if (hash.token_type === 'bearer') { | ||
20 | this.token_type = 'Bearer'; | ||
21 | } else { | ||
22 | this.token_type = hash.token_type; | ||
23 | } | ||
24 | } | ||
25 | } | ||
26 | |||
27 | save() { | ||
28 | localStorage.setItem('access_token', this.access_token); | ||
29 | localStorage.setItem('refresh_token', this.refresh_token); | ||
30 | localStorage.setItem('token_type', this.token_type); | ||
31 | } | ||
32 | } | ||