Small fixes

This commit is contained in:
Jerzy Kwiatkowski 2024-01-12 10:57:52 +01:00
parent 1c6c7b3266
commit 974a1fec10

View File

@ -12,22 +12,22 @@ function App() {
const [results, setResults] = useState('');
const [isVisible, setIsVisible] = useState(true);
const fetchDataFromAPI = async (dataset, table, column) => {
const fetchDataFromAPI = async (ldataset, ltable, lcolumn, tdataset, ttable, tcolumn) => {
try {
const response = await axios.get(`https://cat-fact.herokuapp.com/facts/?dataset=${dataset}&table=${table}&column=${column}`);
const data = response.data;
postML(entryId, ldataset, ltable, lcolumn, tdataset, ttable, tcolumn);
setResults(data);
} catch (error) {
console.error('Error fetching data:', error);
console.error('ERROR fetching data:', error);
setResults('Error fetching data');
}
};
const handleButtonClick = () => {
fetchDataFromAPI(datasetQuarry, tableQuarry, columns);
fetchDataFromAPI(datasetQuarry2, tableQuarry2, columns2, datasetQuarry, tableQuarry, columns);
};
const toggleVisibility = () => {
setIsVisible(!isVisible);
};