fix: arreglar petición para borrar gráficas en el historial.

This commit is contained in:
Alexis
2026-04-15 11:12:40 +02:00
parent 0c1d446139
commit b077106326
2 changed files with 5 additions and 4 deletions
+3 -2
View File
@@ -35,8 +35,9 @@ export default function History() {
await deleteHistoryItem(id);
setHistoryItems(prev => prev.filter(item => item._id !== id && item.id !== id));
if (expandedId === id) setExpandedId(null);
} catch (error) {
alert("Error al borrar: " + error);
} catch (err) {
const errorMessage = err.response?.data?.detail || err.message || "Error desconocido";
alert("Error al borrar: " + errorMessage);
}
};
+2 -2
View File
@@ -40,9 +40,9 @@ export const getUserHistory = async () => {
}
};
export const deleteHistoryItem = async (id) => {
export const deleteHistoryItem = async (historyId) => {
try {
const response = await api.delete(`/history/${id}`);
const response = await api.delete(`/history/delete/${historyId}`);
return response.data;
} catch (error) {
if (error.response && error.response.data) throw error.response.data;