From 982513c86e2b7e9964781d5df6ce63edd20cd8a5 Mon Sep 17 00:00:00 2001 From: rockyeverlast Date: Wed, 19 Mar 2025 12:30:45 +0530 Subject: [PATCH] Fixed delete modal / PassWord hide show --- src/Pages/ManageCMS/FAQ/FAQ.tsx | 16 +++++++++++----- src/components/ui/password-input.tsx | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Pages/ManageCMS/FAQ/FAQ.tsx b/src/Pages/ManageCMS/FAQ/FAQ.tsx index cb93fa1..110a895 100644 --- a/src/Pages/ManageCMS/FAQ/FAQ.tsx +++ b/src/Pages/ManageCMS/FAQ/FAQ.tsx @@ -57,7 +57,8 @@ const FAQ = () => { const [faqToggle] = useFaqToggleMutation() const [deleteFaqPost] = useDeleteFaqPostMutation() const [searchTerm, setSearchTerm] = useState(""); - const [deleteModal, setDeleteModal] = useState(true) + const [deleteModal, setDeleteModal] = useState(false) + const [selectedFaqId, setSelectedFaqId] = useState(null); // console.log('DATA', data?.data); @@ -128,15 +129,20 @@ const FAQ = () => { setDeleteModal(true)} />} + AltertTiggerIcon={() => { + setSelectedFaqId(agency.id); + setDeleteModal(true) + }} />} alertText="Delete FAQ" alertIcon={} alertCaption="are you sure you want to delete ?" onClose={() => setDeleteModal(false)} onConfirm={() => { - // console.log("User deleted:", index + 1); - setDeleteModal(false); - handleDeleteFaq(agency.id) + // console.log("Deleting FAQ with ID:", selectedFaqId); // Correct ID + if (selectedFaqId) { + setDeleteModal(false); + handleDeleteFaq(selectedFaqId); + } }} /> diff --git a/src/components/ui/password-input.tsx b/src/components/ui/password-input.tsx index 03b8415..cc3bfa5 100644 --- a/src/components/ui/password-input.tsx +++ b/src/components/ui/password-input.tsx @@ -66,7 +66,7 @@ export const PasswordInput = React.forwardRef< setVisible(!visible) }} > - {visible ? visibilityIcon.off : visibilityIcon.on} + {visible ? visibilityIcon.on : visibilityIcon.off} } {...rootProps}