From 0e5aaf6d3976b9a46b48f554d004f3b90ca8b813 Mon Sep 17 00:00:00 2001 From: Ognjen Cirkovic Date: Sat, 30 Apr 2022 19:45:20 +0200 Subject: Omoguceno na frontu da se guestu refresha token. --- backend/api/api/Services/TempRemovalService.cs | 2 +- frontend/src/app/_services/auth.service.ts | 10 +--------- frontend/src/app/app.component.ts | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/backend/api/api/Services/TempRemovalService.cs b/backend/api/api/Services/TempRemovalService.cs index 525ff386..9e6b7f96 100644 --- a/backend/api/api/Services/TempRemovalService.cs +++ b/backend/api/api/Services/TempRemovalService.cs @@ -29,7 +29,7 @@ namespace api.Services List tempUsers=_user.Find(u=>u.isPermament==false).ToList(); foreach (User user in tempUsers) { - if ((DateTime.Now.ToUniversalTime() - user.dateCreated).TotalMinutes < 1) + if ((DateTime.Now.ToUniversalTime() - user.dateCreated).TotalDays < 1) continue; List tempPredictors=_predictor.Find(p=>p.uploaderId==user._id).ToList(); List tempModels=_model.Find(m=>m.uploaderId==user._id).ToList(); diff --git a/frontend/src/app/_services/auth.service.ts b/frontend/src/app/_services/auth.service.ts index 845cb3f5..92920b24 100644 --- a/frontend/src/app/_services/auth.service.ts +++ b/frontend/src/app/_services/auth.service.ts @@ -52,21 +52,13 @@ 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); }); }, exp.getTime() - new Date().getTime() - 60000); - } - else { - this.refresher = setTimeout(() => { - this.getGuestToken().subscribe((response) => { - this.authenticate(response); - }); - }, exp.getTime() - new Date().getTime() - 60000); - } + } addGuestToken() { diff --git a/frontend/src/app/app.component.ts b/frontend/src/app/app.component.ts index e301b46f..dfe4febc 100644 --- a/frontend/src/app/app.component.ts +++ b/frontend/src/app/app.component.ts @@ -43,7 +43,7 @@ export class AppComponent implements OnInit, AfterViewInit { if(!this.authService.alreadyGuest()) this.authService.addGuestToken(); } - this.signalRService.startConnection(); + //this.signalRService.startConnection(); //this.startHttpRequest(); } } -- cgit v1.2.3