From e5d39107d1389c2b67fe3910a35cbb1a44fbdeaa Mon Sep 17 00:00:00 2001 From: Dejan Date: Sat, 26 Oct 2024 14:45:52 +0200 Subject: [PATCH] - Fixed issue with adding new grocery item but without a category always --- components/pages/grocery/EditGroceryItem.tsx | 4 ++++ components/pages/grocery/GroceryList.tsx | 1 + contexts/ToDosContext.tsx | 2 -- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/components/pages/grocery/EditGroceryItem.tsx b/components/pages/grocery/EditGroceryItem.tsx index 3806a66..d86c868 100644 --- a/components/pages/grocery/EditGroceryItem.tsx +++ b/components/pages/grocery/EditGroceryItem.tsx @@ -116,6 +116,10 @@ const EditGroceryItem = ({ editGrocery }: { editGrocery: IEditGrocery }) => { }); console.log("kategorija vo diropdown: " + item.value); if (editGrocery.closeEdit) editGrocery.closeEdit(false); + } else { + if (editGrocery.setCategory) { + editGrocery.setCategory(item.value); + } } }} /> diff --git a/components/pages/grocery/GroceryList.tsx b/components/pages/grocery/GroceryList.tsx index 5add444..e66305b 100644 --- a/components/pages/grocery/GroceryList.tsx +++ b/components/pages/grocery/GroceryList.tsx @@ -32,6 +32,7 @@ const GroceryList = () => { const [category, setCategory] = useState( GroceryCategory.None ); + const [title, setTitle] = useState(""); const [submit, setSubmitted] = useState(false); diff --git a/contexts/ToDosContext.tsx b/contexts/ToDosContext.tsx index 6fadc5e..25ff49f 100644 --- a/contexts/ToDosContext.tsx +++ b/contexts/ToDosContext.tsx @@ -1,8 +1,6 @@ import { createContext, FC, ReactNode, useContext, useState } from "react"; import {IToDo} from "@/hooks/firebase/types/todoData"; -import {useGetGroceries} from "@/hooks/firebase/useGetGroceries"; import {useGetTodos} from "@/hooks/firebase/useGetTodos"; -import {useCreateGrocery} from "@/hooks/firebase/useCreateGrocery"; import {useCreateTodo} from "@/hooks/firebase/useCreateTodo"; import {useUpdateTodo} from "@/hooks/firebase/useUpdateTodo";