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/shared/users/user.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/shared/users/user.model.ts')
-rw-r--r-- | client/app/shared/users/user.model.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/client/app/shared/users/user.model.ts b/client/app/shared/users/user.model.ts new file mode 100644 index 000000000..ca0a5f26c --- /dev/null +++ b/client/app/shared/users/user.model.ts | |||
@@ -0,0 +1,20 @@ | |||
1 | import { Token } from './token.model'; | ||
2 | |||
3 | export class User { | ||
4 | username: string; | ||
5 | token: Token; | ||
6 | |||
7 | static load() { | ||
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() { | ||
17 | localStorage.setItem('username', this.username); | ||
18 | this.token.save(); | ||
19 | } | ||
20 | } | ||