implement token exp
This commit is contained in:
@@ -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],
|
||||
|
||||
Reference in New Issue
Block a user