edit index.js
This commit is contained in:
parent
c88ba741f1
commit
17cf1f1cbb
@ -5,7 +5,6 @@ import ContentBox from "../components/ContentBox";
|
||||
import Header from "../components/Header";
|
||||
import DateAndTime from "../components/DateAndTime";
|
||||
import Search from "../components/Search";
|
||||
|
||||
import MetricsBox from "../components/MetricsBox";
|
||||
import MetricsCard from "../components/MetricsCard";
|
||||
import UnitSwitch from "../components/UnitSwitch";
|
||||
@ -26,7 +25,6 @@ const App = () => {
|
||||
body: JSON.stringify({ input }),
|
||||
});
|
||||
const data = await res.json();
|
||||
|
||||
setWeatherData({ ...data });
|
||||
setInput("");
|
||||
};
|
||||
@ -35,6 +33,20 @@ const App = () => {
|
||||
getData();
|
||||
}, []);
|
||||
|
||||
// useEffect(() => {
|
||||
// const getData = async () => {
|
||||
// const res = await fetch("api/data", {
|
||||
// method: "POST",
|
||||
// headers: { "Content-Type": "application/json" },
|
||||
// body: JSON.stringify({ input }),
|
||||
// });
|
||||
// const data = await res.json();
|
||||
// setWeatherData({ ...data });
|
||||
// setInput("");
|
||||
// };
|
||||
// getData();
|
||||
// }, []);
|
||||
|
||||
const enterKeydown = (e) => {
|
||||
if (e.keyCode === 13) {
|
||||
getData();
|
||||
|
Loading…
x
Reference in New Issue
Block a user