윤희찬

Update main.js

...@@ -9,12 +9,15 @@ searchForm.addEventListener('submit', function(event){ ...@@ -9,12 +9,15 @@ searchForm.addEventListener('submit', function(event){
9 alert('한글자 이상 입력해주세요'); 9 alert('한글자 이상 입력해주세요');
10 event.preventDefault(); 10 event.preventDefault();
11 } 11 }
12 - searchQuery = event.target.querySelector('input').value; 12 + else{
13 - fetchAPI(); 13 + event.preventDefault();
14 + searchQuery = event.target.querySelector('input').value;
15 + fetchAPI();
16 + }
14 }); 17 });
15 18
16 async function fetchAPI(){ 19 async function fetchAPI(){
17 - const recipeURL = `https://api.edamam.com/search?q=pizza&app_id=${APP_ID}&app_key=${APP_KEY}`; 20 + const recipeURL = `https://api.edamam.com/search?q=${searchQuery}&app_id=${APP_ID}&app_key=${APP_KEY}`;
18 const response = await fetch(recipeURL); 21 const response = await fetch(recipeURL);
19 const data = await response.json(); 22 const data = await response.json();
20 boxinfo(data.hits); 23 boxinfo(data.hits);
......