cancelar-compra.component.ts
1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { Component, OnInit, OnDestroy } from '@angular/core';
import { APP_SETTINGS } from 'src/etc/AppSettings';
import { Location } from '@angular/common';
import { Router } from '@angular/router';
import { ProductoService } from 'src/app/services/producto.service';
@Component({
selector: 'app-cancelar-compra',
templateUrl: './cancelar-compra.component.html',
styleUrls: ['./cancelar-compra.component.scss']
})
export class CancelarCompraComponent implements OnInit, OnDestroy {
private apiDeboSuite: string = APP_SETTINGS.apiDeboSuite;
private timer: any;
constructor(
private location: Location,
private router: Router,
private productoService: ProductoService
) { }
ngOnInit() {
this.timer = setTimeout(() => {
this.limpiarCarritoYvolver();
}, 30000)
}
ngOnDestroy() {
clearTimeout(this.timer);
}
volverPreviousPage() {
this.location.back();
}
limpiarCarritoYvolver() {
this.productoService.productoAcargar = undefined;
this.productoService.promoAcargar = undefined;
this.productoService.productos = [];
this.router.navigate(['/home']);
}
}