mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 13:26:08 +00:00
git pull made
This commit is contained in:
@@ -72,7 +72,7 @@ export class BackgroundService {
|
||||
async offline() {
|
||||
|
||||
if(this.status == 'offline') {
|
||||
return false
|
||||
return true
|
||||
}
|
||||
|
||||
const hasReachedTheServer = await this.tryToReachTheServer()
|
||||
@@ -90,7 +90,11 @@ export class BackgroundService {
|
||||
e.funx()
|
||||
}
|
||||
})
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -101,11 +105,15 @@ export class BackgroundService {
|
||||
|
||||
try {
|
||||
await this.http.post(environment.apiURL + "UserAuthentication/Login", '', opts).toPromise();
|
||||
|
||||
return true
|
||||
} catch (error) {
|
||||
if(error.status != 400) {
|
||||
|
||||
if(error.status === 0) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -7,14 +8,21 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
export class HttpErrorHandle {
|
||||
|
||||
constructor(
|
||||
private toastService: ToastService
|
||||
private toastService: ToastService,
|
||||
private backgroundService: BackgroundService
|
||||
) { }
|
||||
|
||||
httpStatusHandle(error) {
|
||||
async httpStatusHandle(error) {
|
||||
switch (error.status
|
||||
) {
|
||||
case 0:
|
||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||
const result = await this.backgroundService.offline()
|
||||
if(result) {
|
||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case 400:
|
||||
this.toastService._badRequest('Lamentamos, mas houve um problema com sua solicitação. Por favor, tente novamente')
|
||||
|
||||
@@ -399,13 +399,12 @@ export class TaskService {
|
||||
if (activityName == 'Tarefa de Despacho' || activityName == 'Concluir Despacho') {
|
||||
this.router.navigate(['/home/gabinete-digital/despachos-pr', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
else if (activityName == 'Revisar Diploma' || activityName == 'Assinar Diploma') {
|
||||
else if (activityName == 'Revisar Diploma' || activityName == 'Diploma Assinado') {
|
||||
this.router.navigate(['/home/gabinete-digital/diplomas', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
else if (activityName == 'Diploma Assinado') {
|
||||
} else if ( activityName == 'Assinar Diploma') {
|
||||
this.router.navigate(['/home/gabinete-digital/diplomas-assinar', serialNumber, 'gabinete-digital']);
|
||||
} else {
|
||||
|
||||
throw('Bug!');
|
||||
}
|
||||
}
|
||||
else if (workflowName == 'Pedido de Parecer' || workflowName == 'Pedido de Deferimento') {
|
||||
|
||||
Reference in New Issue
Block a user