add: añadir funcionalidad de guardar y ver historial si estás logeado

This commit is contained in:
Alexis
2026-04-07 09:08:51 +02:00
parent de641dad14
commit fec840b3be
6 changed files with 317 additions and 51 deletions
+30
View File
@@ -18,4 +18,34 @@ export const buildFuzzyGraph = async (payload) => {
console.error('Error building fuzzy graph:', error);
throw error.response?.data?.detail || error.message;
}
};
export const saveToHistory = async (payload) => {
try {
const response = await api.post('/history/add', payload);
return response.data;
} catch (error) {
console.error('Error saving to history:', error);
throw error.response?.data?.detail || error.message;
}
};
export const getUserHistory = async () => {
try {
const response = await api.get('/history/user');
return response.data;
} catch (error) {
console.error('Error fetching history:', error);
throw error.response?.data?.detail || error.message;
}
};
export const deleteHistoryItem = async (id) => {
try {
const response = await api.delete(`/history/delete/${id}`);
return response.data;
} catch (error) {
console.error('Error deleting history item:', error);
throw error.response?.data?.detail || error.message;
}
};