Commit 67fe26a5 authored by Weiser's avatar Weiser
Browse files

Merge branch 'devbackend' of...

Merge branch 'devbackend' of https://transfer.hft-stuttgart.de/gitlab/22kaen1bdi/swp_ss24_wetterdaten_sammeln into devbackend
parents 0331081e f31da304
...@@ -18,8 +18,24 @@ const Currentdata = (props) => { ...@@ -18,8 +18,24 @@ const Currentdata = (props) => {
<div> <div>
<div className="thq-grid-5"> <div className="thq-grid-5">
<div class="filter"> <div class="filter">
<label for="location">Location:</label> <label htmlFor="location">Location:</label>
<input type="text" id="city_text" placeholder="Location" /> <input
type="text"
id="city_text"
placeholder="Location"
value={query}
onChange={handleInputChange}
/>
{data.map((item) => (
<ListItem
key={item.id}
name={item.name}
country={item.country}
region={item.region}
lat={item.lat}
lon={item.lon}
/>
))}
<br /> <br />
<label for="region">Region:</label> <label for="region">Region:</label>
<input type="text" id="region_text" placeholder="Region" /> <input type="text" id="region_text" placeholder="Region" />
...@@ -446,7 +462,7 @@ const Currentdata = (props) => { ...@@ -446,7 +462,7 @@ const Currentdata = (props) => {
console.log("FilterString = " + filterString); console.log("FilterString = " + filterString);
const apiUrl = `http://localhost:8080/currentweather?q=${city_text}&filter=${filterString}`; const apiUrl = `http://localhost:8080/currentweather?q=${latitude_text},${longitude_text}&filter=${filterString}`;
fetch(apiUrl) fetch(apiUrl)
.then((response) => { .then((response) => {
...@@ -496,7 +512,11 @@ const Currentdata = (props) => { ...@@ -496,7 +512,11 @@ const Currentdata = (props) => {
const ListItem = ({ name, country, region, lat, lon }) => { const ListItem = ({ name, country, region, lat, lon }) => {
const handleClick = () => { const handleClick = () => {
alert(`Element geklickt: ${name}`); document.getElementById("city_text").value = name;
document.getElementById("region_text").value = country;
document.getElementById("country_text").value = region;
document.getElementById("latitude_text").value = lat;
document.getElementById("longitude_text").value = lon;
}; };
return ( return (
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment