Correções de segurança

This commit is contained in:
2025-12-06 10:56:52 -03:00
parent bd830fc575
commit 4966611eec
4 changed files with 97 additions and 25 deletions

View File

@@ -118,7 +118,14 @@
'X-Requested-With': 'XMLHttpRequest'
}
})
.then(response => response.json())
.then(async response => {
const text = await response.text();
try {
return JSON.parse(text);
} catch (e) {
throw new Error(`Resposta inválida do servidor (${response.status}): ${text.substring(0, 100)}...`);
}
})
.then(data => {
this.$dispatch('notify', {
type: data.success ? 'success' : 'error',
@@ -127,10 +134,11 @@
});
})
.catch(error => {
console.error('Erro no teste:', error);
this.$dispatch('notify', {
type: 'error',
title: 'Erro',
message: 'Falha na requisição.'
message: 'Erro: ' + error.message
});
})
.finally(() => {