fx rename

This commit is contained in:
madarsbiss 2021-07-27 17:34:19 +03:00
parent c7d30863be
commit e31bace094

View File

@ -8,7 +8,7 @@ export default function Home() {
const [weatherData, setWeatherData] = useState(); const [weatherData, setWeatherData] = useState();
const getData = async () => { const getData = async () => {
const res = await fetch("/api/data", { const res = await fetch("api/data", {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ input }), body: JSON.stringify({ input }),
@ -19,7 +19,7 @@ export default function Home() {
setInput(""); setInput("");
}; };
const something = (event) => { const enterKeydown = (event) => {
if (event.keyCode === 13) { if (event.keyCode === 13) {
getData(); getData();
} }
@ -159,7 +159,7 @@ export default function Home() {
className={styles.searchInput} className={styles.searchInput}
onFocus={(e) => (e.target.value = "")} onFocus={(e) => (e.target.value = "")}
onChange={(e) => setInput(e.target.value)} onChange={(e) => setInput(e.target.value)}
onKeyDown={(e) => something(e)} onKeyDown={(e) => enterKeydown(e)}
/> />
</div> </div>
@ -337,7 +337,7 @@ export default function Home() {
className={styles.searchInput} className={styles.searchInput}
onFocus={(e) => (e.target.value = "")} onFocus={(e) => (e.target.value = "")}
onChange={(e) => setInput(e.target.value)} onChange={(e) => setInput(e.target.value)}
onKeyDown={(e) => something(e)} onKeyDown={(e) => enterKeydown(e)}
/> />
</div> </div>
) : ( ) : (