diff options
author | Danijel Andjelkovic <adanijel99@gmail.com> | 2022-03-15 16:32:35 +0100 |
---|---|---|
committer | Danijel Andjelkovic <adanijel99@gmail.com> | 2022-03-15 16:32:35 +0100 |
commit | dd5834672ba1cc54362425462bfebd31959f693a (patch) | |
tree | 5ba255b7c963eaf998ca36196b708ecb01dd3c3d /frontend/src/app/_services | |
parent | 6938b1f8fd0a8d27b9fdcc5bc114ffabcd4bac68 (diff) |
Dodate stranice za sve linkove.
Diffstat (limited to 'frontend/src/app/_services')
-rw-r--r-- | frontend/src/app/_services/auth.service.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/frontend/src/app/_services/auth.service.ts b/frontend/src/app/_services/auth.service.ts index e6611880..afc1567b 100644 --- a/frontend/src/app/_services/auth.service.ts +++ b/frontend/src/app/_services/auth.service.ts @@ -41,7 +41,6 @@ export class AuthService { if (!exp) { exp = new Date(); } - console.log(exp, exp?.getTime()); this.refresher = setTimeout(() => { console.log('refreshing token!'); this.http.post(`${API_SETTINGS.apiURL}/auth/renewJwt`, {}, { headers: this.authHeader(), responseType: 'text' }).subscribe((response) => { @@ -51,8 +50,11 @@ export class AuthService { } authenticate(token: string) { - const user = jwtHelper.decodeToken(token); - this.cookie.set('token', token, user.exp); + let exp = jwtHelper.getTokenExpirationDate(token); + if (!exp) { + exp = new Date(); + } + this.cookie.set('token', token, exp); this.updateUser(); } |