diff --git a/src/pages/home/components/SearchBar.js b/src/pages/home/components/SearchBar.js
index 0554cf98ab9dfdeddbbdb1577ee2fc93087f67b8..5607ae82d68072ab8cfa73502e803cfae7bf00b3 100644
--- a/src/pages/home/components/SearchBar.js
+++ b/src/pages/home/components/SearchBar.js
@@ -2,17 +2,15 @@ import React, { useState } from 'react'
import TextField from '@mui/material/TextField';
import { Stack } from '@mui/material';
import Autocomplete from '@mui/material/Autocomplete';
+var axios = require("axios").default;
function SearchBar(props) {
const [suggestions, setSuggestions] = useState([])
- const [items, setItems] = useState("")
-
+ let items = [];
const handleChange = (event) => {
- setItems(event.target.value)
- var axios = require("axios").default;
-
+ items = event.target.value;
var options = {
method: 'GET',
url: 'https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/food/ingredients/autocomplete',
@@ -22,16 +20,14 @@ function SearchBar(props) {
'x-rapidapi-key': '9488865383msh30a38be9ec16e99p109d9bjsn9090d29ce12f'
}
};
-
+
axios.request(options).then(function (response) {
setSuggestions(response.data.map(result => result.name))
}).catch(function (error) {
console.error(error);
});
-
}
-
const handleSubmit = (event, value) => {
event.preventDefault()
if (value) {