From 1e46c9e34274b14556c56c2867675482a0f1604f Mon Sep 17 00:00:00 2001 From: LixayTF Date: Wed, 20 Sep 2023 15:38:00 +0200 Subject: [PATCH] API update --- src/App.js | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/src/App.js b/src/App.js index 58ece28..c92b296 100644 --- a/src/App.js +++ b/src/App.js @@ -1,5 +1,6 @@ import './App.css'; import { useState } from 'react'; +import axios from 'axios'; function App() { const [datasetQuarry, setDatasetQuarry] = useState(''); @@ -7,10 +8,23 @@ function App() { const [columns, setColumns] = useState(''); const [results, setResults] = useState(''); - const handleButtonClick = () => { - - setResults('Tutaj możesz umieścić swoje wyniki.'); + const fetchDataFromAPI = async (dataset, table, column) => { + try { + const response = await axios.get(`YOUR_API_ENDPOINT?dataset=${dataset}&table=${table}&column=${column}`); + const data = response.data; + + setResults(data); + } catch (error) { + console.error('Error fetching data:', error); + setResults('Error fetching data'); + } }; + + const handleButtonClick = () => { + // Call the API request function with the provided parameters + fetchDataFromAPI(datasetQuarry, tableQuarry, columns); + }; + return (
@@ -40,34 +54,17 @@ function App() {
- - //
- //
- // logo - //

- // Edit src/App.js and save to reload. - //

- // - // Learn React - // - //
- //
); }