navigation after adding recipes

This commit is contained in:
fred 2025-07-08 11:13:01 -07:00
parent cd234531b9
commit e74f247415
3 changed files with 21 additions and 10 deletions

View file

@ -13,8 +13,6 @@ function Cookbook() {
const loadRecipes = async () => {
try {
const recipes = await getRecipes();
console.log(recipes)
console.log("here")
setRecipes(recipes);
} catch (error) {
console.log(error);
@ -28,10 +26,9 @@ function Cookbook() {
}
}, [shouldFetchRecipes]);
const handleDelete = async (id) => {
const handleDelete = async (id: number | void) => {
try {
await deleteRecipe(id);
// Trigger a re-fetch by setting the state variable to true
setShouldFetchRecipes(true);
} catch (error) {
console.error("Error deleting recipe:", error);