diff --git a/client/src/components/History.js b/client/src/components/History.js index 26d93fb..436611c 100644 --- a/client/src/components/History.js +++ b/client/src/components/History.js @@ -132,13 +132,16 @@ const History = () => { const [edit, setEdit] = useState(false); const [deleted, setDeleted] = useState(); - useEffect(async () => { - await fetch(`${process.env.REACT_APP_BASE_URL}/history`) - .then((res) => res.json()) - .then((data) => { - setHistory(data); - setLoading(false); - }); + useEffect(() => { + async function fetchData() { + fetch(`${process.env.REACT_APP_BASE_URL}/history`) + .then((res) => res.json()) + .then((data) => { + setHistory(data); + setLoading(false); + }); + } + fetchData(); }, [prediction, deleted]); const handleUpdate = (image_id, image_prediction) => { diff --git a/client/src/components/Layout.js b/client/src/components/Layout.js index 21cd0b0..cc838ef 100644 --- a/client/src/components/Layout.js +++ b/client/src/components/Layout.js @@ -7,6 +7,7 @@ import Home from "./Home"; const Layout = () => { const { component } = useParams(); + console.log("component", component); return (
@@ -21,7 +22,7 @@ const Layout = () => {
- {component === "history" ? : component === undefined ? : } + {component === "history" ? : component === undefined || component === null ? : }
diff --git a/server/app.py b/server/app.py index 586bc0d..6631570 100644 --- a/server/app.py +++ b/server/app.py @@ -9,7 +9,7 @@ from datetime import datetime import uuid import cloudinary -from cloudinary.uploader import upload, destroy +from cloudinary.uploader import upload from cloudinary.utils import cloudinary_url app = Flask(__name__)