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