Skip to content

Commit

Permalink
Fix routing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
its-id committed Apr 11, 2023
1 parent 2c51485 commit 255d4d3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
17 changes: 10 additions & 7 deletions client/src/components/History.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Home from "./Home";

const Layout = () => {
const { component } = useParams();
console.log("component", component);
return (
<div className="min-h-full">
<Navbar component={component} />
Expand All @@ -21,7 +22,7 @@ const Layout = () => {
</header>
<main>
<div className="mx-auto max-w-7xl sm:px-6 lg:px-8">
{component === "history" ? <History /> : component === undefined ? <Home /> : <Page404 />}
{component === "history" ? <History /> : component === undefined || component === null ? <Home /> : <Page404 />}
</div>
</main>
</div>
Expand Down
2 changes: 1 addition & 1 deletion server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down

0 comments on commit 255d4d3

Please sign in to comment.