feature/rbac y perfiles implementados

This commit is contained in:
2026-05-21 08:00:43 -06:00
parent 546a411df8
commit dc5f9fd6ce
29 changed files with 2007 additions and 977 deletions

View File

@@ -1,4 +1,5 @@
import { fetchWithAuth } from '../fetchWithAuth';
import { extractApiError } from '../api/apiError';
const API_URL = import.meta.env.VITE_EFC_API_URL;
@@ -13,7 +14,8 @@ export const downloadFile = async (id, filename = 'archivo', showMessage) => {
const res = await fetchWithAuth(`${API_URL}/record/documents/descargar/${id}/`);
if (!res.ok) {
showMessage('Error en la descarga del archivo', 'error');
const errMsg = await extractApiError(res);
showMessage(errMsg, 'error');
return;
}
@@ -50,8 +52,11 @@ export const downloadBulkZip = async (ids, showMessage, pedimentoName) => {
body: JSON.stringify({ document_ids: ids })
});
if (!response.ok) throw new Error('Error en la descarga');
if (!response.ok) {
const errMsg = await extractApiError(response);
throw new Error(errMsg);
}
const blob = await response.blob();
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');