Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 1x 4x 1x 3x 3x 2x 1x 1x 2x | // src/api/certs.js
import httpRequest from '../utils/httpClient';
const generateCert = async (options) => {
// console.log('-> Función generateCert ejecutada.');
// console.log('Parámetros recibidos para generar certificado:', options);
// Lógica de validación básica (aunque simple para este ejemplo)
if (!options || typeof options !== 'object') {
throw new Error('Opciones de certificado inválidas.');
}
// Usamos el cliente HTTP simulado
try {
const response = await httpRequest('/certs/generate', options);
// console.log('Respuesta del servidor simulada para generar certificado:', response);
if (!response.success) {
throw new Error(
response.message || 'Error desconocido al generar certificado.',
);
}
return { certificateId: response.id, status: response.message };
} catch (error) {
// console.error('Error en generateCert:', error);
throw new Error(`Fallo en la generación del certificado: ${error.message}`);
}
};
export { generateCert };
export default generateCert;
|