aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/angular/users/models/user.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-04-14 22:07:46 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-04-14 22:07:46 +0200
commit1553e15d82b8a1ec4967a90d43b33274f8215c44 (patch)
treeee53fdbb32895153a1fd2470e1c51cf1d9a38e77 /client/angular/users/models/user.ts
parent0c1cbbfe29d91c95f9c574b57adf067654b8b5b4 (diff)
downloadPeerTube-1553e15d82b8a1ec4967a90d43b33274f8215c44.tar.gz
PeerTube-1553e15d82b8a1ec4967a90d43b33274f8215c44.tar.zst
PeerTube-1553e15d82b8a1ec4967a90d43b33274f8215c44.zip
Implement user requests autorizations in the client side
Diffstat (limited to 'client/angular/users/models/user.ts')
-rw-r--r--client/angular/users/models/user.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/client/angular/users/models/user.ts b/client/angular/users/models/user.ts
new file mode 100644
index 000000000..2c56a6132
--- /dev/null
+++ b/client/angular/users/models/user.ts
@@ -0,0 +1,20 @@
1import { Token } from './token';
2
3export class User {
4 username: string;
5 token: Token;
6
7 constructor (username: string, hash_token: any) {
8 this.username = username;
9 this.token = new Token(hash_token);
10 }
11
12 static load(): User {
13 return new User(localStorage.getItem('username'), Token.load());
14 }
15
16 save(): void {
17 localStorage.setItem('username', this.username);
18 this.token.save();
19 }
20}