Skip to content
Snippets Groups Projects
Commit 00055443 authored by zh393's avatar zh393
Browse files

added no ingredients found message if api can't find any ingredients

parent 6ba1c372
Branches
No related tags found
No related merge requests found
......@@ -20,7 +20,12 @@ function SearchBar(props) {
};
axios.request(options).then(function (response) {
console.log(response.data.length)
if (response.data.length === 0) {
setSuggestions(["No ingredients found"]);
} else {
setSuggestions(response.data.map(result => result.name))
}
}).catch(function (error) {
console.error(error);
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment