From 62594167d19dd99afdb80ddfc92431dfa410d581 Mon Sep 17 00:00:00 2001 From: Allen Liao Date: Mon, 22 Apr 2024 12:10:19 -0500 Subject: [PATCH] add search food error checking, and update nav bar link: --- src/components/NavBar.jsx | 2 +- src/pages/food/CreateFood.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/NavBar.jsx b/src/components/NavBar.jsx index 93ce8c2..eecba77 100644 --- a/src/components/NavBar.jsx +++ b/src/components/NavBar.jsx @@ -8,7 +8,7 @@ function NavBar() {
- Food + Food Recipe Queue My Account diff --git a/src/pages/food/CreateFood.js b/src/pages/food/CreateFood.js index 11a5312..8ed473b 100644 --- a/src/pages/food/CreateFood.js +++ b/src/pages/food/CreateFood.js @@ -14,6 +14,10 @@ export default function CreateFood() { }, body: JSON.stringify({food: food}) }) + if (!res.ok) { + window.alert("Failed searching food!") + return + } const foods = await res.json() console.log(foods) setResults(foods.data)