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