From e22b83919e6442dfb55d7953d9227268c850adf8 Mon Sep 17 00:00:00 2001 From: Danijel Andjelkovic Date: Thu, 17 Mar 2022 00:32:49 +0100 Subject: Napravio neophodne izmene tako da backend i frontend komuniciraju uspesno. --- frontend/src/app/_services/auth.service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'frontend/src/app/_services/auth.service.ts') diff --git a/frontend/src/app/_services/auth.service.ts b/frontend/src/app/_services/auth.service.ts index afc1567b..20ff45f3 100644 --- a/frontend/src/app/_services/auth.service.ts +++ b/frontend/src/app/_services/auth.service.ts @@ -46,7 +46,7 @@ export class AuthService { this.http.post(`${API_SETTINGS.apiURL}/auth/renewJwt`, {}, { headers: this.authHeader(), responseType: 'text' }).subscribe((response) => { this.authenticate(response); }); - }, exp.getTime() - new Date().getTime()); + }, exp.getTime() - new Date().getTime() - 60000); } authenticate(token: string) { @@ -62,6 +62,7 @@ export class AuthService { if (this.cookie.check('token')) { const token = this.cookie.get('token'); this.shared.loggedIn = this.isAuthenticated(); + this.shared.username = jwtHelper.decodeToken(token).name; this.enableAutoRefresh(); } } -- cgit v1.2.3