Commit ca8fe76d authored by EnesKarakas's avatar EnesKarakas
Browse files

csy

parent 3c0e9b8d
......@@ -18,8 +18,24 @@ const Currentdata = (props) => {
<div>
<div className="thq-grid-5">
<div class="filter">
<label for="location">Location:</label>
<input type="text" id="city_text" placeholder="Location" />
<label htmlFor="location">Location:</label>
<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 />
<label for="region">Region:</label>
<input type="text" id="region_text" placeholder="Region" />
......@@ -420,7 +436,7 @@ const Currentdata = (props) => {
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)
.then((response) => {
......@@ -470,7 +486,11 @@ const Currentdata = (props) => {
const ListItem = ({ name, country, region, lat, lon }) => {
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 (
......
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