Commit 797574ed9dfa11e5b722c4fc711bd7c53bf3e95c

Authored by Marcelo Puebla
1 parent 9b79dc0e51
Exists in master and in 1 other branch validar_pve

Logica para volver al home.

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