]>
Commit | Line | Data |
---|---|---|
41a2aee3 | 1 | import { Token } from './token.model'; |
1553e15d C |
2 | |
3 | export class User { | |
4 | username: string; | |
5 | token: Token; | |
6 | ||
ccf6ed16 | 7 | static load() { |
881a5e68 C |
8 | return new User(localStorage.getItem('username'), Token.load()); |
9 | } | |
10 | ||
ccf6ed16 | 11 | constructor(username: string, hash_token: any) { |
1553e15d C |
12 | this.username = username; |
13 | this.token = new Token(hash_token); | |
14 | } | |
15 | ||
ccf6ed16 | 16 | save() { |
1553e15d C |
17 | localStorage.setItem('username', this.username); |
18 | this.token.save(); | |
19 | } | |
20 | } |