Commit df8b91332e72e1264555a127bd8554df62afd39c
1 parent
797574ed9d
Exists in
master
and in
1 other branch
Espacio.
Showing
1 changed file
with
1 additions
and
0 deletions
Show diff stats
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'; | 3 | import { ProductoService } from 'src/app/services/producto.service'; |
4 | import { Router } from '@angular/router'; | 4 | import { Router } from '@angular/router'; |
5 | 5 | ||
6 | @Component({ | 6 | @Component({ |
7 | selector: 'app-mensaje-final', | 7 | selector: 'app-mensaje-final', |
8 | templateUrl: './mensaje-final.component.html', | 8 | templateUrl: './mensaje-final.component.html', |
9 | styleUrls: ['./mensaje-final.component.scss'] | 9 | styleUrls: ['./mensaje-final.component.scss'] |
10 | }) | 10 | }) |
11 | export class MensajeFinalComponent implements OnInit { | 11 | export class MensajeFinalComponent implements OnInit { |
12 | 12 | ||
13 | private apiUrl: string = appSettings.apiUrl; | 13 | private apiUrl: string = appSettings.apiUrl; |
14 | private timer: any; | 14 | private timer: any; |
15 | 15 | ||
16 | constructor( | 16 | constructor( |
17 | private productoService: ProductoService, | 17 | private productoService: ProductoService, |
18 | private router: Router | 18 | private router: Router |
19 | ) { } | 19 | ) { } |
20 | 20 | ||
21 | ngOnInit() { | 21 | ngOnInit() { |
22 | 22 | ||
23 | this.timer = setTimeout(() => { | 23 | this.timer = setTimeout(() => { |
24 | |||
24 | this.limpiarCarritoYvolver(); | 25 | this.limpiarCarritoYvolver(); |
25 | }, 30000) | 26 | }, 30000) |
26 | } | 27 | } |
27 | 28 | ||
28 | ngOnDestroy() { | 29 | ngOnDestroy() { |
29 | 30 | ||
30 | clearTimeout(this.timer); | 31 | clearTimeout(this.timer); |
31 | } | 32 | } |
32 | 33 | ||
33 | limpiarCarritoYvolver() { | 34 | limpiarCarritoYvolver() { |
34 | 35 | ||
35 | this.productoService.productoAcargar = undefined; | 36 | this.productoService.productoAcargar = undefined; |
36 | this.productoService.promoAcargar = undefined; | 37 | this.productoService.promoAcargar = undefined; |
37 | this.productoService.productos = []; | 38 | this.productoService.productos = []; |
38 | this.router.navigate(['/home']); | 39 | this.router.navigate(['/home']); |
39 | } | 40 | } |
40 | 41 | ||
41 | } | 42 | } |
42 | 43 |