Commit cb3fcc1fe6726c030730428d3a080eadc5ab88e2
1 parent
c85fe3e41b
Exists in
master
Agregado init para limpiar carrito despues de 30 segundos.
Showing
1 changed file
with
10 additions
and
1 deletions
Show diff stats
src/app/components/cancelar-compra/cancelar-compra.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 { Location } from '@angular/common'; | 3 | import { Location } from '@angular/common'; |
4 | import { Router } from '@angular/router'; | 4 | import { Router } from '@angular/router'; |
5 | import { ProductoService } from 'src/app/services/producto.service'; | ||
5 | 6 | ||
6 | @Component({ | 7 | @Component({ |
7 | selector: 'app-cancelar-compra', | 8 | selector: 'app-cancelar-compra', |
8 | templateUrl: './cancelar-compra.component.html', | 9 | templateUrl: './cancelar-compra.component.html', |
9 | styleUrls: ['./cancelar-compra.component.scss'] | 10 | styleUrls: ['./cancelar-compra.component.scss'] |
10 | }) | 11 | }) |
11 | export class CancelarCompraComponent implements OnInit { | 12 | export class CancelarCompraComponent implements OnInit { |
12 | 13 | ||
13 | private apiUrl: string = appSettings.apiUrl; | 14 | private apiUrl: string = appSettings.apiUrl; |
14 | 15 | ||
15 | constructor( | 16 | constructor( |
16 | private location: Location, | 17 | private location: Location, |
17 | private router: Router | 18 | private router: Router, |
19 | private productoService : ProductoService | ||
18 | ) { } | 20 | ) { } |
19 | 21 | ||
20 | ngOnInit() { | 22 | ngOnInit() { |
23 | |||
24 | setTimeout(() => { | ||
25 | this.limpiarCarritoYvolver(); | ||
26 | }, 30000) | ||
21 | } | 27 | } |
22 | 28 | ||
23 | volverPreviousPage() { | 29 | volverPreviousPage() { |
24 | 30 | ||
25 | this.location.back(); | 31 | this.location.back(); |
26 | } | 32 | } |
27 | 33 | ||
28 | limpiarCarritoYvolver(){ | 34 | limpiarCarritoYvolver(){ |
29 | 35 | ||
36 | this.productoService.productoAcargar = undefined; | ||
37 | this.productoService.promoAcargar = undefined; | ||
38 | this.productoService.productos = []; | ||
30 | this.router.navigate(['/home']); | 39 | this.router.navigate(['/home']); |
31 | } | 40 | } |
32 | 41 | ||
33 | } | 42 | } |
34 | 43 |