Compare commits
6 Commits
reportes
...
T2025-10-1
| Author | SHA1 | Date | |
|---|---|---|---|
| 769a1fd4e8 | |||
| 70f0b38e93 | |||
| d8c23dcf09 | |||
| 756815983d | |||
| 33ca76c054 | |||
| bdabc94974 |
5
.env
5
.env
@@ -1,5 +0,0 @@
|
||||
VITE_DEBUG_MODE=true
|
||||
|
||||
VITE_EFC_API_URL=http://192.168.1.79:8000/api/v1
|
||||
VITE_EFC_MICROSERVICE_URL=http://192.168.1.79:8001/api/v1
|
||||
VITE_EFC_MICROSERVICE_URL_2=http://192.168.1.79:8001/api/v2
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -23,3 +23,4 @@ dist-ssr
|
||||
*.sln
|
||||
*.sw?
|
||||
.env
|
||||
*.bak
|
||||
68
src/api/pedimentoCompleto.ts
Normal file
68
src/api/pedimentoCompleto.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
// src\api\pedimentoCompleto.ts
|
||||
import { fetchWithAuth } from '../fetchWithAuth';
|
||||
|
||||
export interface PedimentoCompleto {
|
||||
id: string;
|
||||
organizacion: string;
|
||||
pedimento: string;
|
||||
pedimento_numero: string;
|
||||
archivo: string;
|
||||
document_type: number;
|
||||
size: number;
|
||||
extension: string;
|
||||
fuente: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface PedimentoCompletoResponse {
|
||||
count: number;
|
||||
next: string | null;
|
||||
previous: string | null;
|
||||
results: PedimentoCompleto[];
|
||||
}
|
||||
|
||||
export interface DocumentFilters {
|
||||
document_type?: string;
|
||||
archivo__icontains?: string;
|
||||
extension?: string;
|
||||
created_at__date?: string;
|
||||
ordering?: string;
|
||||
}
|
||||
|
||||
const API_URL = (import.meta as any).env.VITE_EFC_API_URL;
|
||||
|
||||
export async function fetchPedimentoCompleto(
|
||||
pedimentoId: string,
|
||||
page: number = 1,
|
||||
pageSize: number = 10,
|
||||
filters: DocumentFilters = {}
|
||||
): Promise<PedimentoCompletoResponse> {
|
||||
try {
|
||||
// Construir URL con filtros
|
||||
const params = new URLSearchParams({
|
||||
page: page.toString(),
|
||||
page_size: pageSize.toString(),
|
||||
pedimento: pedimentoId
|
||||
});
|
||||
|
||||
// Agregar filtros si existen
|
||||
Object.entries(filters).forEach(([key, value]) => {
|
||||
if (value !== undefined && value !== '') {
|
||||
params.append(key, value.toString());
|
||||
}
|
||||
});
|
||||
|
||||
// const res = await fetchWithAuth(`${API_URL}/record/documents/?${params.toString()}`);
|
||||
const res = await fetchWithAuth(`${API_URL}/record/pedimento-documents/?${params.toString()}`);
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error('No autorizado o error en la petición');
|
||||
}
|
||||
|
||||
return res.json();
|
||||
} catch (error) {
|
||||
console.error('Error in fetchPedimentoCompleto:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user