diff --git a/src/app/pages/gabinete-digital/pedidos/pedidos.page.ts b/src/app/pages/gabinete-digital/pedidos/pedidos.page.ts index e0faa6cd2..75dded269 100644 --- a/src/app/pages/gabinete-digital/pedidos/pedidos.page.ts +++ b/src/app/pages/gabinete-digital/pedidos/pedidos.page.ts @@ -1,5 +1,5 @@ import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; -import { ActivatedRoute, NavigationEnd, NavigationExtras, Router } from '@angular/router'; +import { ActivatedRoute, NavigationEnd, NavigationExtras, NavigationStart, Router } from '@angular/router'; import { CalendarComponent } from 'ionic2-calendar'; import { DailyWorkTask, tasksList } from '../../../models/dailyworktask.model'; import { ProcessesService } from 'src/app/services/processes.service'; @@ -50,12 +50,15 @@ export class PedidosPage implements OnInit { } ngOnInit() { - const location = window.location - const pathname = location.pathname + location.search - + + this.LoadList(); + this.router.events.forEach((event) => { - if (event instanceof NavigationEnd && event.url.startsWith(pathname)) { - this.LoadList(); + if(event instanceof NavigationStart && '/home/gabinete-digital/pedidos?parecer=true'.startsWith(event.url) || + event instanceof NavigationStart && '/home/gabinete-digital/pedidos?deferimento=true'.startsWith(event.url) + ) { + alert('resfresh') + this.refreshing() } }); } @@ -76,7 +79,7 @@ export class PedidosPage implements OnInit { this.router.navigate(['/home/gabinete-digital/pedidos'], navigationExtras); - this.LoadList(); + // this.LoadList(); } goToPedido(serialNumber:any){ diff --git a/src/app/shared/gabinete-digital/pedidos/pedidos.page.ts b/src/app/shared/gabinete-digital/pedidos/pedidos.page.ts index 139abf27f..0194fe446 100644 --- a/src/app/shared/gabinete-digital/pedidos/pedidos.page.ts +++ b/src/app/shared/gabinete-digital/pedidos/pedidos.page.ts @@ -54,8 +54,8 @@ export class PedidosPage implements OnInit { this.router.events.forEach((event) => { if(event instanceof NavigationStart && '/home/gabinete-digital?parecer=true'.startsWith(event.url) || - event instanceof NavigationEnd && '/home/gabinete-digital?deferimento=true'.startsWith(event.url) || - event instanceof NavigationEnd && '/home/gabinete-digital?pedidos=true'.startsWith(event.url) + event instanceof NavigationStart && '/home/gabinete-digital?deferimento=true'.startsWith(event.url) || + event instanceof NavigationStart && '/home/gabinete-digital?pedidos=true'.startsWith(event.url) ) { this.doRefresh() }