diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index b5fc645..a0f2d10 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -44,15 +44,13 @@ export default function App() { const handleSaveEdit = (id: string, editData: Restaurant) => { - if (!id) return; - axios + return axios .put(`/api/restaurant/${id}`, editData) .then((response) => { setRestaurants(prevRestaurants => prevRestaurants.map(r => r.id === id ? response.data : r) ); - navigate(`/`); }) .catch((error) => console.error("Error saving restaurant edits:", error)); }; diff --git a/frontend/src/components/Details.tsx b/frontend/src/components/Details.tsx index b611a7f..13c56c3 100644 --- a/frontend/src/components/Details.tsx +++ b/frontend/src/components/Details.tsx @@ -4,7 +4,7 @@ import { useEffect, useState } from "react"; import {useNavigate, useParams} from "react-router-dom"; type detailsEditProps = { - handleSaveEdit: (id:string, editData:Restaurant) => void; + handleSaveEdit: (id:string, editData:Restaurant) => Promise; } export default function Details(props: Readonly) { @@ -83,7 +83,7 @@ export default function Details(props: Readonly) { cols={40} /> - +