This commit is contained in:
tiago.kayaya
2021-09-16 09:35:09 +01:00
parent bc1cf6ef73
commit 42ef6f0dc4
3 changed files with 38 additions and 9 deletions
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { NavigationStart, Router } from '@angular/router';
import { LoginUserRespose } from 'src/app/models/user.model';
import { AuthService } from 'src/app/services/auth.service';
import { ProcessesService } from 'src/app/services/processes.service';
@@ -26,6 +26,16 @@ export class AllProcessesPage implements OnInit {
ngOnInit() {
this.loadAllProcesses();
this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith('/home/gabinete-digital')) {
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing();
} else {
this.loadAllProcesses();
}
}
});
}
doRefresh() {
@@ -35,6 +45,13 @@ export class AllProcessesPage implements OnInit {
}, 1000);
}
refreshing() {
setTimeout(() => {
this.loadAllProcesses();
}, 1000);
}
async loadAllProcesses(){
let allProcessesList = await this.processesService.GetTasksList("", false).toPromise();
console.log(allProcessesList);