navigation after adding recipes
This commit is contained in:
parent
cd234531b9
commit
e74f247415
3 changed files with 21 additions and 10 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue