aboutsummaryrefslogblamecommitdiffhomepage
path: root/client/app/shared/users/user.model.ts
blob: ca0a5f26ca01213471b2ec263c6cbbc0fe6dc3f2 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                                      




                   
                 


                                                                    
                                                  



                                       
          



                                                    
import { Token } from './token.model';

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

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

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

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