feat: implement route planning dashboard including KPIs, user workload tracking, and route assignment management features
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { ApiResponse } from '../../core/models/route.model';
|
||||
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
|
||||
import { ApiResponse } from '../models/route.model';
|
||||
import { environment } from '../../../environments/environment';
|
||||
import { catchError, timeout, throwError } from 'rxjs';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class RutasService {
|
||||
@@ -9,8 +11,20 @@ export class RutasService {
|
||||
|
||||
calcularRutas(data: FormData) {
|
||||
return this.http.post<ApiResponse>(
|
||||
'https://agenteit.digitalcompass.agency/webhook/calcular-camino',
|
||||
environment.n8nWebhookUrl,
|
||||
data
|
||||
).pipe(
|
||||
timeout(environment.requestTimeoutMs),
|
||||
catchError((err: HttpErrorResponse | Error) => {
|
||||
if (err instanceof Error && err.name === 'TimeoutError') {
|
||||
return throwError(() => Object.assign(new Error('Timeout al calcular rutas (30s). Intenta con menos filas o reintenta.'), { name: 'TimeoutError' }));
|
||||
}
|
||||
return throwError(() => err);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
reoptimizarRutas(data: FormData) {
|
||||
return this.calcularRutas(data);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user