Commit a306f67827f51cfd8fcafa4911b16bf00f5e4efa
1 parent
12803ee663
Exists in
develop
and in
1 other branch
arreglo bugs
Showing
1 changed file
with
2 additions
and
2 deletions
Show diff stats
src/app/modules/admin/admin.component.ts
1 | import { Component, OnInit, HostListener } from '@angular/core'; | 1 | import { Component, OnInit, HostListener } from '@angular/core'; |
2 | import { Router } from '@angular/router'; | 2 | import { Router } from '@angular/router'; |
3 | 3 | ||
4 | @Component({ | 4 | @Component({ |
5 | selector: 'app-admin', | 5 | selector: 'app-admin', |
6 | templateUrl: './admin.component.html', | 6 | templateUrl: './admin.component.html', |
7 | styleUrls: ['./admin.component.scss'] | 7 | styleUrls: ['./admin.component.scss'] |
8 | }) | 8 | }) |
9 | 9 | ||
10 | export class AdminComponent implements OnInit { | 10 | export class AdminComponent implements OnInit { |
11 | timerReposo: any; | 11 | timerReposo: any; |
12 | 12 | ||
13 | constructor( | 13 | constructor( |
14 | private router: Router, | 14 | private router: Router, |
15 | ) { } | 15 | ) { } |
16 | 16 | ||
17 | ngOnInit() { | 17 | ngOnInit() { |
18 | this.startTimeOutInactividad(); | 18 | this.startTimeOutInactividad(); |
19 | } | 19 | } |
20 | 20 | ||
21 | @HostListener('document:click', ['$event']) | 21 | @HostListener('document:click', ['$event']) |
22 | 22 | ||
23 | documentClick(event: MouseEvent) { | 23 | documentClick(event: MouseEvent) { |
24 | if (event){ | 24 | if (event) { |
25 | this.restartTimer(); | 25 | this.restartTimer(); |
26 | } | 26 | } |
27 | } | 27 | } |
28 | 28 | ||
29 | restartTimer() { | 29 | restartTimer() { |
30 | clearTimeout(this.timerReposo); | 30 | clearTimeout(this.timerReposo); |
31 | this.startTimeOutInactividad(); | 31 | this.startTimeOutInactividad(); |
32 | } | 32 | } |
33 | 33 | ||
34 | startTimeOutInactividad() { | 34 | startTimeOutInactividad() { |
35 | this.timerReposo = setTimeout(() => { | 35 | this.timerReposo = setTimeout(() => { |
36 | this.router.navigate(['cancelar-compra']); | 36 | this.router.navigate(['cancelar-compra']); |
37 | }, 90000); | 37 | }, 90000); |
38 | } | 38 | } |
39 | 39 | ||
40 | } | 40 | } |
41 | 41 |