inactive-screen.service.ts 534 Bytes
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';

@Injectable({
  providedIn: 'root'
})
export class InactiveScreenService {
  timerReposo: any;

  constructor(
    private router: Router,
  ) { }

  startTimeOutInactividad() {
    this.timerReposo = setTimeout(() => {
      if (this.router.url === '/pago-electronico' || this.router.url === '/pago-tarjeta') {
        this.startTimeOutInactividad();
      } else {
        this.router.navigate(['cancelar-compra']);
      }
    }, 90000);
  }
}