aboutsummaryrefslogblamecommitdiffhomepage
path: root/client/angular/users/models/user.ts
blob: 3367e3bb52cd5fbeaae9898f21eefe8275571d69 (plain) (tree)
1
2
3
4
5
6
7
8
9
10





                                



                                                                    




                                                   




                                                    
import { Token } from './token';

export class User {
  username: string;
  token: Token;

  static load(): User {
    return new User(localStorage.getItem('username'), Token.load());
  }

  constructor (username: string, hash_token: any) {
    this.username = username;
    this.token = new Token(hash_token);
  }

  save(): void {
    localStorage.setItem('username', this.username);
    this.token.save();
  }
}