Commit e3edb9e03c10990b0f78145f460171739e6edde9

Authored by Marcelo Puebla
Exists in develop

Merge branch 'develop' into 'develop'

Develop

See merge request !103
src/app/shared/cancelar-compra/cancelar-compra.component.ts
1 import { Component, OnInit, OnDestroy } from '@angular/core'; 1 import { Component, OnInit, OnDestroy } from '@angular/core';
2 import { Location } from '@angular/common'; 2 import { Location } from '@angular/common';
3 import { ArticuloService } from 'src/app/services/articulo/articulo.service'; 3 import { ArticuloService } from 'src/app/services/articulo/articulo.service';
4 import { Router } from '@angular/router'; 4 import { Router } from '@angular/router';
5 5
6 @Component({ 6 @Component({
7 selector: 'app-cancelar-compra', 7 selector: 'app-cancelar-compra',
8 templateUrl: './cancelar-compra.component.html', 8 templateUrl: './cancelar-compra.component.html',
9 styleUrls: ['./cancelar-compra.component.scss'] 9 styleUrls: ['./cancelar-compra.component.scss']
10 }) 10 })
11 export class CancelarCompraComponent implements OnInit, OnDestroy { 11 export class CancelarCompraComponent implements OnInit, OnDestroy {
12 timer: any; 12 timer: any;
13 13
14 constructor( 14 constructor(
15 private location: Location, 15 private location: Location,
16 private router: Router, 16 private router: Router,
17 private articuloService: ArticuloService 17 private articuloService: ArticuloService
18 ) { } 18 ) { }
19 19
20 ngOnInit() { 20 ngOnInit() {
21 this.timer = setTimeout(() => { 21 this.timer = setTimeout(() => {
22 this.limpiarCarritoYvolver(); 22 this.limpiarCarritoYvolver();
23 }, 90000); 23 }, 90000);
24 } 24 }
25 25
26 ngOnDestroy() { 26 ngOnDestroy() {
27 clearTimeout(this.timer); 27 clearTimeout(this.timer);
28 } 28 }
29 29
30 volverPreviousPage() { 30 volverPreviousPage() {
31 this.location.back(); 31 this.location.back();
32 } 32 }
33 33
34 limpiarCarritoYvolver() { 34 limpiarCarritoYvolver() {
35 this.articuloService.carrito = []; 35 this.articuloService.carrito = [];
36 this.articuloService.calcularTotal();
36 this.router.navigate(['/']); 37 this.router.navigate(['/']);
37 } 38 }
38 } 39 }
39 40