From b1794c53ac97d77a16c10ed915336f08cff1e5e3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 22 Mar 2016 15:51:54 +0100 Subject: Login in Angular : first draft --- client/angular/users/models/authStatus.ts | 4 ++++ client/angular/users/models/token.ts | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 client/angular/users/models/authStatus.ts create mode 100644 client/angular/users/models/token.ts (limited to 'client/angular/users/models') diff --git a/client/angular/users/models/authStatus.ts b/client/angular/users/models/authStatus.ts new file mode 100644 index 000000000..f646bd4cf --- /dev/null +++ b/client/angular/users/models/authStatus.ts @@ -0,0 +1,4 @@ +export enum AuthStatus { + LoggedIn, + LoggedOut +} diff --git a/client/angular/users/models/token.ts b/client/angular/users/models/token.ts new file mode 100644 index 000000000..688dfdc80 --- /dev/null +++ b/client/angular/users/models/token.ts @@ -0,0 +1,17 @@ +export class Token { + access_token: string; + refresh_token: string; + token_type: string; + + constructor (hash) { + this.access_token = hash.access_token; + this.refresh_token = hash.refresh_token; + this.token_type = hash.token_type; + } + + save() { + localStorage.setItem('access_token', this.access_token); + localStorage.setItem('refresh_token', this.refresh_token); + localStorage.setItem('token_type', this.token_type); + } +} -- cgit v1.2.3