aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_services/auth.service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/app/_services/auth.service.ts')
-rw-r--r--frontend/src/app/_services/auth.service.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/frontend/src/app/_services/auth.service.ts b/frontend/src/app/_services/auth.service.ts
index ef340684..9e3f9f2f 100644
--- a/frontend/src/app/_services/auth.service.ts
+++ b/frontend/src/app/_services/auth.service.ts
@@ -1,4 +1,4 @@
-import { Injectable } from '@angular/core';
+import { EventEmitter, Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { JwtHelperService } from '@auth0/angular-jwt';
import { CookieService } from 'ngx-cookie-service';
@@ -12,6 +12,8 @@ const jwtHelper = new JwtHelperService();
})
export class AuthService {
+ public loggedInEvent: EventEmitter<boolean> = new EventEmitter();
+
shared = shared;
constructor(private http: HttpClient, private cookie: CookieService) { }
@@ -52,7 +54,7 @@ export class AuthService {
var property = jwtHelper.decodeToken(this.cookie.get('token'));
var username = property['name'];
if (username != "") {
-
+
this.refresher = setTimeout(() => {
this.http.post(`${Configuration.settings.apiURL}/auth/renewJwt`, {}, { headers: this.authHeader(), responseType: 'text' }).subscribe((response) => {
this.authenticate(response);
@@ -81,6 +83,7 @@ export class AuthService {
}
this.cookie.set('token', token, exp);
this.updateUser();
+ this.loggedInEvent.emit(true);
}
updateUser() {