From 07819844d5ef7e323fd956eacfedecb2f4f4bb80 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Fri, 17 Nov 2023 15:16:23 +0700
Subject: Update result feature

---
 src/modules/result/components/ProductModal.tsx | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'src/modules/result/components/ProductModal.tsx')

diff --git a/src/modules/result/components/ProductModal.tsx b/src/modules/result/components/ProductModal.tsx
index a4ef49e..001c946 100644
--- a/src/modules/result/components/ProductModal.tsx
+++ b/src/modules/result/components/ProductModal.tsx
@@ -1,3 +1,4 @@
+import { useResultStore } from '@/common/stores/useResultStore'
 import { Input, Modal, ModalBody, ModalContent, ModalHeader, Pagination, Skeleton, Table, TableBody, TableCell, TableColumn, TableHeader, TableRow } from '@nextui-org/react'
 import { Product } from '@prisma/client'
 import { useQuery } from '@tanstack/react-query'
@@ -15,18 +16,19 @@ const ProductModal = ({ modal }: Props) => {
   const [page, setPage] = useState(1)
   const [search, setSearch] = useState("")
   const debouncedSearch = useDebounce(search, 500)
+  const { filter } = useResultStore()
 
   useEffect(() => {
     setPage(1)
   }, [debouncedSearch])
 
   const { data } = useQuery({
-    queryKey: ['product', page, debouncedSearch],
+    queryKey: ['product', page, debouncedSearch, filter.company],
     queryFn: async () => {
       const searchParams = new URLSearchParams({
         page: page.toString(),
         search: debouncedSearch,
-        type: 'all'
+        companyId: filter.company
       })
       const response = await fetch(`/api/product?${searchParams}`)
       const data: {
-- 
cgit v1.2.3

