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