Skip to content

Commit

Permalink
Adicionando um temporizador para o Popup de renovação do token
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoCarlito committed Dec 8, 2023
1 parent b52840c commit b563df7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/app/pages/profile/profile.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { AlertService } from 'src/app/services/alert.service';
import { ConfirmationService, MessageService } from 'primeng/api';
import { AuthService } from 'src/app/services/auth.service';
import { HttpErrorResponse } from '@angular/common/http';
import { take, timer } from 'rxjs';

type ErrorResponseType = HttpErrorResponse;

Expand All @@ -32,6 +33,11 @@ export class ProfileComponent {
ngOnInit(): void {
this.setUserIdFromToken(localStorage.getItem('token') as string);
this.getUser();
timer(15 * 60 * 1000)
.pipe(take(1))
.subscribe(() => {
this.showRenewTokenDialog();
});
}

setUserIdFromToken(token: string) {
Expand Down

0 comments on commit b563df7

Please sign in to comment.