summaryrefslogtreecommitdiffstats
path: root/ui/src/services/UserService.ts
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2019-10-18 17:20:27 -0700
committerDessalines <tyhou13@gmx.com>2019-10-18 17:20:27 -0700
commit4e5561283392d2ab1545cabb4455a8ffc490f86b (patch)
treea4ee9cc096826dc32faf3675212c7f95f1b3ea5e /ui/src/services/UserService.ts
parent82ea5ae9186e5a8e631c87a61077e16713eb87a4 (diff)
Running prettier on code.
- #305 , #309
Diffstat (limited to 'ui/src/services/UserService.ts')
-rw-r--r--ui/src/services/UserService.ts24
1 files changed, 13 insertions, 11 deletions
diff --git a/ui/src/services/UserService.ts b/ui/src/services/UserService.ts
index ac4d4850..5ca5ff07 100644
--- a/ui/src/services/UserService.ts
+++ b/ui/src/services/UserService.ts
@@ -5,13 +5,15 @@ import * as jwt_decode from 'jwt-decode';
import { Subject } from 'rxjs';
export class UserService {
-
private static _instance: UserService;
public user: User;
- public sub: Subject<{user: User, unreadCount: number}> = new Subject<{user: User, unreadCount: number}>();
+ public sub: Subject<{ user: User; unreadCount: number }> = new Subject<{
+ user: User;
+ unreadCount: number;
+ }>();
private constructor() {
- let jwt = Cookies.get("jwt");
+ let jwt = Cookies.get('jwt');
if (jwt) {
this.setUser(jwt);
} else {
@@ -22,30 +24,30 @@ export class UserService {
public login(res: LoginResponse) {
this.setUser(res.jwt);
- Cookies.set("jwt", res.jwt, { expires: 365 });
- console.log("jwt cookie set");
+ Cookies.set('jwt', res.jwt, { expires: 365 });
+ console.log('jwt cookie set');
}
public logout() {
this.user = undefined;
- Cookies.remove("jwt");
+ Cookies.remove('jwt');
setTheme();
- this.sub.next({user: undefined, unreadCount: 0});
- console.log("Logged out.");
+ this.sub.next({ user: undefined, unreadCount: 0 });
+ console.log('Logged out.');
}
public get auth(): string {
- return Cookies.get("jwt");
+ return Cookies.get('jwt');
}
private setUser(jwt: string) {
this.user = jwt_decode(jwt);
setTheme(this.user.theme);
- this.sub.next({user: this.user, unreadCount: 0});
+ this.sub.next({ user: this.user, unreadCount: 0 });
console.log(this.user);
}
- public static get Instance(){
+ public static get Instance() {
return this._instance || (this._instance = new this());
}
}