diff --git a/src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts b/src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts
index 852090f..6c4c1ba 100644
--- a/src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts
+++ b/src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts
@@ -1,30 +1,42 @@
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, OnDestroy } from '@angular/core';
import { appSettings } from 'src/etc/AppSettings';
import { Location } from '@angular/common';
import { ProductoService } from 'src/app/services/producto.service';
import { Producto } from 'src/app/wrappers/producto';
+import { Router } from '@angular/router';
@Component({
selector: 'app-confirmacion-carrito',
templateUrl: './confirmacion-carrito.component.html',
styleUrls: ['./confirmacion-carrito.component.scss']
})
-export class ConfirmacionCarritoComponent implements OnInit {
+export class ConfirmacionCarritoComponent implements OnInit, OnDestroy {
- productos: Producto[] = [];
- total: number = 0;
+ private productos: Producto[] = [];
+ private total: number = 0;
private apiUrl: string = appSettings.apiUrl;
+ private timerReposo: any;
constructor(
private location: Location,
- private productoService: ProductoService
+ private productoService: ProductoService,
+ private router: Router
) { }
ngOnInit() {
+ this.timerReposo = setTimeout(() => {
+
+ this.router.navigate(['cancelar-compra']);
+ }, 90000)
this.productos = this.productoService.productos;
}
+ ngOnDestroy() {
+
+ clearTimeout(this.timerReposo);
+ }
+
volverPreviousPage() {
this.location.back();
@@ -40,4 +52,13 @@ export class ConfirmacionCarritoComponent implements OnInit {
return this.total = subTotal;
}
+ reiniciarTimer() {
+
+ clearTimeout(this.timerReposo);
+ this.timerReposo = setTimeout(() => {
+
+ this.router.navigate(['cancelar-compra']);
+ }, 90000)
+ }
+
}