implement token exp

This commit is contained in:
2024-07-09 14:37:00 +07:00
parent d8dc510742
commit f86f727ac7
29 changed files with 152 additions and 25 deletions

View File

@@ -3,6 +3,8 @@ import { FormBuilder, FormGroup, NgForm, Validators } from "@angular/forms";
import { LoginService } from "../../service/login.service";
import { ToastrService } from "ngx-toastr";
import { jwtDecode } from "jwt-decode";
import { AuthService } from "src/app/_services/auth.service";
import { Router } from "@angular/router";
interface CustomJwtPayload {
exp: number;
scope: string;
@@ -35,12 +37,16 @@ export class ProfilInformationComponent {
constructor(
private formBuilder: FormBuilder,
private authService: LoginService,
private toastr: ToastrService
private toastr: ToastrService,
public logoutService: AuthService,
private router: Router
) {}
ngOnInit(): void {
this.storedData = JSON.parse(localStorage.getItem("account_info"));
this.currentUser = JSON.parse(localStorage.getItem("currentUser"));
this.authService.checkTokenAndRedirect();
this.profilInfo = this.formBuilder.group({
firstName: ["", Validators.required],
lastName: ["", Validators.required],