Skip to content
Snippets Groups Projects
Commit 2aab4967 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #14454 TIME 0:15 reset filter when user log

parent 8df9a7b0
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,7 @@ import { HeaderService } from '../../service/header.service'; ...@@ -13,6 +13,7 @@ import { HeaderService } from '../../service/header.service';
import { FunctionsService } from '../../service/functions.service'; import { FunctionsService } from '../../service/functions.service';
import { TimeLimitPipe } from '../../plugins/timeLimit.pipe'; import { TimeLimitPipe } from '../../plugins/timeLimit.pipe';
import { AlertComponent } from '../../plugins/modal/alert.component'; import { AlertComponent } from '../../plugins/modal/alert.component';
import { LocalStorageService } from '../../service/local-storage.service';
@Component({ @Component({
templateUrl: 'login.component.html', templateUrl: 'login.component.html',
...@@ -35,6 +36,7 @@ export class LoginComponent implements OnInit { ...@@ -35,6 +36,7 @@ export class LoginComponent implements OnInit {
private router: Router, private router: Router,
private headerService: HeaderService, private headerService: HeaderService,
public authService: AuthService, public authService: AuthService,
private localStorage: LocalStorageService,
private functionsService: FunctionsService, private functionsService: FunctionsService,
private notify: NotificationService, private notify: NotificationService,
public dialog: MatDialog, public dialog: MatDialog,
...@@ -75,6 +77,7 @@ export class LoginComponent implements OnInit { ...@@ -75,6 +77,7 @@ export class LoginComponent implements OnInit {
} }
).pipe( ).pipe(
tap((data: any) => { tap((data: any) => {
this.localStorage.resetLocal();
this.authService.saveTokens(data.headers.get('Token'), data.headers.get('Refresh-Token')); this.authService.saveTokens(data.headers.get('Token'), data.headers.get('Refresh-Token'));
this.authService.setUser({}); this.authService.setUser({});
if (this.authService.getCachedUrl()) { if (this.authService.getCachedUrl()) {
......
...@@ -6,7 +6,7 @@ import { Injectable } from '@angular/core'; ...@@ -6,7 +6,7 @@ import { Injectable } from '@angular/core';
export class LocalStorageService { export class LocalStorageService {
appSession: any; appSession: any;
constructor() {} constructor() { }
setAppSession(id: string) { setAppSession(id: string) {
this.appSession = id; this.appSession = id;
...@@ -27,4 +27,18 @@ export class LocalStorageService { ...@@ -27,4 +27,18 @@ export class LocalStorageService {
remove(id: string) { remove(id: string) {
localStorage.removeItem(id + '_' + this.getAppSession()); localStorage.removeItem(id + '_' + this.getAppSession());
} }
resetLocal() {
const arr = [];
for (let i = 0; i < localStorage.length; i++) {
if (localStorage.key(i).substring(0, 13) === 'filtersAdmin_') {
arr.push(localStorage.key(i));
}
}
// Iterate over arr and remove the items by key
for (let i = 0; i < arr.length; i++) {
localStorage.removeItem(arr[i]);
}
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment