Commit 2f21bbf0070c5e271e41375503783c479e5339ca
Exists in
develop
Merge branch 'develop' into 'develop'
Develop See merge request !124
Showing
1 changed file
Show diff stats
src/app/modules/mensaje-final/mensaje-final.component.ts
| 1 | |||
| 2 | |||
| 1 | import { Component, OnInit } from '@angular/core'; | 3 | import { Component, OnInit } from '@angular/core'; |
| 2 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; | 4 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; |
| 3 | import { Router } from '@angular/router'; | 5 | import { Router } from '@angular/router'; |
| 4 | 6 | ||
| 5 | @Component({ | 7 | @Component({ |
| 6 | selector: 'app-mensaje-final', | 8 | selector: 'app-mensaje-final', |
| 7 | templateUrl: './mensaje-final.component.html', | 9 | templateUrl: './mensaje-final.component.html', |
| 8 | styleUrls: ['./mensaje-final.component.scss'] | 10 | styleUrls: ['./mensaje-final.component.scss'] |
| 9 | }) | 11 | }) |
| 10 | export class MensajeFinalComponent implements OnInit { | 12 | export class MensajeFinalComponent implements OnInit { |
| 11 | timer: any; | 13 | timer: any; |
| 12 | 14 | ||
| 13 | constructor( | 15 | constructor( |
| 14 | public articuloService: ArticuloService, | 16 | public articuloService: ArticuloService, |
| 15 | private router: Router | 17 | private router: Router, |
| 16 | ) {} | 18 | ) { } |
| 17 | 19 | ||
| 18 | ngOnInit() { | 20 | ngOnInit() { |
| 21 | this.timer = setTimeout(() => { | ||
| 22 | this.goToSplash(); | ||
| 23 | }, 90000); | ||
| 19 | this.mediaPantalla(); | 24 | this.mediaPantalla(); |
| 20 | } | 25 | } |
| 21 | 26 | ||
| 22 | OnDestroy() {} | 27 | OnDestroy() { |
| 28 | clearTimeout(this.timer); | ||
| 29 | } | ||
| 23 | 30 | ||
| 24 | goToSplash() { | 31 | goToSplash() { |
| 25 | this.articuloService.cleanShoppingCar(); | 32 | this.articuloService.cleanShoppingCar(); |
| 26 | this.router.navigate(['']); | 33 | this.router.navigate(['']); |
| 27 | } | 34 | } |
| 28 | 35 | ||
| 29 | mediaPantalla() { | 36 | mediaPantalla() { |
| 30 | if ($('body').hasClass('media-pantalla')) { | 37 | if ($('body').hasClass('media-pantalla')) { |
| 31 | $('body').removeClass('media-pantalla'); | 38 | $('body').removeClass('media-pantalla'); |
| 32 | } | 39 | } |
| 33 | } | 40 | } |
| 34 | } | 41 | } |
| 35 | 42 |