-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
26 lines (23 loc) · 858 Bytes
/
test.js
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
const axios = require('axios');
async function testApiRequest(bi) {
try {
const response = await axios.post('https://bi-bs.minjusdh.gov.ao/pims-backend/api/v1/progress', {
affairsReceipt: bi,
affairsType: 'IDCard',
captchaValue: ''
});
// Verifique se a resposta contém o estado de progresso do BI
if (response.data && response.data.affairsProgressState) {
return response.data.affairsProgressState;
} else {
return 'Unexpected response structure';
}
} catch (error) {
// Retorna a mensagem de erro
return `Error in API request: ${error.message}`;
}
}
// Exemplo de uso
testApiRequest('006255318BA048')
.then(result => console.log('API Response:', result))
.catch(error => console.error('API Error:', error));