se modifico auditor y pagina de procesos

This commit is contained in:
2025-10-12 07:52:06 -06:00
parent c924aab9c1
commit 03a9f793b1
5 changed files with 1049 additions and 1384 deletions

View File

@@ -1,31 +1,29 @@
import { fetchWithAuth } from '../fetchWithAuth';
// Tipos para la respuesta y registros
export interface ProcesamientoPedimento {
id: number;
created_at: string;
updated_at: string;
export interface Task {
task_id: string;
timestamp: string;
message: string;
status: string;
pedimento: string;
organizacion: string;
organizacion_name: string;
estado: number;
tipo_procesamiento: number;
pedimento: string;
servicio: number;
}
export interface ProcesamientoPedimentosResponse {
export interface TasksResponse {
count: number;
next: string | null;
previous: string | null;
results: ProcesamientoPedimento[];
results: Task[];
}
// API para customs/procesamientopedimentos/
export async function fetchProcesamientoPedimentos(
// API para tasks/tasks/
export async function fetchTasks(
page: number = 1,
pageSize: number = 20,
filters: Record<string, any> = {}
): Promise<ProcesamientoPedimentosResponse> {
): Promise<TasksResponse> {
try {
const API_URL = (import.meta as any).env.VITE_EFC_API_URL;
@@ -41,15 +39,15 @@ export async function fetchProcesamientoPedimentos(
}
});
const res = await fetchWithAuth(`${API_URL}/customs/procesamientopedimentos/?${params.toString()}`);
const res = await fetchWithAuth(`${API_URL}/tasks/tasks/?${params.toString()}`);
if (!res.ok) {
throw new Error('Error al obtener procesamiento de pedimentos');
throw new Error('Error al obtener tareas');
}
return await res.json();
} catch (error) {
console.error('Error in fetchProcesamientoPedimentos:', error);
console.error('Error in fetchTasks:', error);
throw error;
}
}