19 lines
568 B
JavaScript
19 lines
568 B
JavaScript
const axios = require('axios');
|
|
const { apiConfig, apiViabilidadeUrl } = require('../config/apiConfig');
|
|
|
|
const DEFAULT_TIMEOUT = (apiConfig && apiConfig.timeoutMs) || 10000;
|
|
|
|
async function consultarViabilidade(data) {
|
|
try {
|
|
const response = await axios.post(apiViabilidadeUrl, data, {
|
|
timeout: DEFAULT_TIMEOUT,
|
|
headers: { 'Content-Type': 'application/json' }
|
|
});
|
|
console.log('Resposta da API de viabilidade:', response.data);
|
|
return (response.data);
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
module.exports = { consultarViabilidade }; |