diff --git a/src/frontend/app/actions/actions.service.ts b/src/frontend/app/actions/actions.service.ts index 1d98b9bdad5f5f179b4682960b9ec97b3846fed2..6f18d1ed0261097d042a60023fd6c7342129ddef 100644 --- a/src/frontend/app/actions/actions.service.ts +++ b/src/frontend/app/actions/actions.service.ts @@ -73,7 +73,7 @@ export class ActionsService { ngOnDestroy(): void { if (this.currentResourceLock) { - clearInterval(this.currentResourceLock); + this.unlockResourceAfterActionModal(this.currentResIds); } } diff --git a/src/frontend/app/process/process.component.ts b/src/frontend/app/process/process.component.ts index 338b167a886703ef0af79c0cfa5f03614c4ac004..e2d04f17222dafc4a08b13da6f187177677b6da0 100755 --- a/src/frontend/app/process/process.component.ts +++ b/src/frontend/app/process/process.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewChild, ViewContainerRef, TemplateRef } from '@angular/core'; +import { Component, OnInit, ViewChild, ViewContainerRef, TemplateRef, OnDestroy } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { LANG } from '../translate.component'; import { NotificationService } from '../notification.service'; @@ -36,7 +36,7 @@ import { PrintedFolderModalComponent } from '../printedFolder/printed-folder-mod ], providers: [AppService, ActionsService, ContactService], }) -export class ProcessComponent implements OnInit { +export class ProcessComponent implements OnInit, OnDestroy { lang: any = LANG; @@ -684,7 +684,7 @@ export class ProcessComponent implements OnInit { ngOnDestroy() { if (this.currentResourceLock) { - clearInterval(this.currentResourceLock); + this.unlockResource(); } // unsubscribe to ensure no memory leaks this.subscription.unsubscribe(); diff --git a/src/frontend/app/signature-book.component.ts b/src/frontend/app/signature-book.component.ts index 7135f0f6576b6a0fca74bdf3112345ecb981f714..32b6ce63ddcbed182e28dd99b9b5a3e36d77fea6 100755 --- a/src/frontend/app/signature-book.component.ts +++ b/src/frontend/app/signature-book.component.ts @@ -601,7 +601,7 @@ export class SignatureBookComponent implements OnInit { ngOnDestroy() { if (this.currentResourceLock) { - clearInterval(this.currentResourceLock); + this.unlockResource(); } // unsubscribe to ensure no memory leaks diff --git a/src/frontend/app/viewer/document-viewer.component.ts b/src/frontend/app/viewer/document-viewer.component.ts index e01c2548241e1f5990b8c69b966844108ecb0d79..15a871f1ff3341dcc4db94bf53f97b1f96786ec1 100755 --- a/src/frontend/app/viewer/document-viewer.component.ts +++ b/src/frontend/app/viewer/document-viewer.component.ts @@ -210,7 +210,7 @@ export class DocumentViewerComponent implements OnInit { ngOnDestroy() { if (this.intervalLockFile) { - clearInterval(this.intervalLockFile); + this.cancelTemplateEdition(); } } diff --git a/src/frontend/service/auth.service.ts b/src/frontend/service/auth.service.ts index 2041c98a858edaa29805ed51cabe33a49bd4f94b..3751d1ff5a61ac60c180ca7b7d0e5cb87351fdd7 100644 --- a/src/frontend/service/auth.service.ts +++ b/src/frontend/service/auth.service.ts @@ -77,13 +77,13 @@ export class AuthService { this.localStorage.remove('MaarchCourrierRefreshToken'); } - logout(cleanUrl: boolean = true) { + async logout(cleanUrl: boolean = true) { if ( this.getToken() !== null && cleanUrl) { this.cleanUrl(JSON.parse(atob(this.getToken().split('.')[1])).user.id); } - this.clearTokens(); this.headerService.setUser(); - this.router.navigate(['/login']); + await this.router.navigate(['/login']); + this.clearTokens(); } saveTokens(token: string, refreshToken: string) {