fix: arreglar petición para borrar gráficas en el historial.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user