This commit is contained in:
Peter Maquiran
2023-07-26 13:06:42 +01:00
parent 9e8bb92b96
commit a08bb5d4f4
18 changed files with 90 additions and 31 deletions
+11 -3
View File
@@ -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')