diff --git a/src/Components/FormField.jsx b/src/Components/FormField.jsx index e7171da..abf6817 100644 --- a/src/Components/FormField.jsx +++ b/src/Components/FormField.jsx @@ -74,7 +74,7 @@ const FormField = ({ diff --git a/src/Pages/AccountDeletion/DeletionHistory.jsx b/src/Pages/AccountDeletion/DeletionHistory.jsx index 0ce07d0..c88f9be 100644 --- a/src/Pages/AccountDeletion/DeletionHistory.jsx +++ b/src/Pages/AccountDeletion/DeletionHistory.jsx @@ -11,45 +11,52 @@ import { } from "@chakra-ui/react"; import React, { useContext, useEffect, useState } from "react"; import { OPACITY_ON_LOAD } from "../../Layout/animations"; -import DataTable from "../../Components/DataTable/DataTable"; +import NormalTable from "../../Components/DataTable/NormalTable"; import Pagination from "../../Components/Pagination"; import GlobalStateContext from "../../Contexts/GlobalStateContext"; import CustomAlertDialog from "../../Components/CustomAlertDialog"; import { formatDate } from "../../Components/Functions/UTCConvertor"; import { CheckIcon, CloseIcon } from "@chakra-ui/icons"; +import { useGetDeleteHistoryQuery } from "../../Services/delete.request.service"; // import { formatDate } from "../../Components/Functions/UTCConvertor"; const DeletionHistory = () => { const toast = useToast(); - const { slideFromRight, deleteHistory, setDeleteHistory } = + const { slideFromRight, setDeleteHistory } = useContext(GlobalStateContext); const [searchTerm, setSearchTerm] = useState(""); - const [isLoading, setIsLoading] = useState(true); const [deleteAlert, setDeleteAlert] = useState(false); const [actionId, setActionId] = useState(false); const [mouseEntered, setMouseEntered] = useState(false); const [mouseEnteredId, setMouseEnteredId] = useState(""); - useEffect(() => { - // Simulate loading - const timer = setTimeout(() => { - setIsLoading(false); - }, 1500); - // Cleanup the timer on component unmount - return () => clearTimeout(timer); - }, []); + + const { + data: deleteHistory, + isLoading, + refetch + } = useGetDeleteHistoryQuery() + + + // Use useEffect to refetch data when the component mounts + useEffect(() => { + refetch(); +}, [refetch]); + +// console.log(deleteHistory?.data); // ====================================================[Table Filter]================================================================ - const filteredData = deleteHistory.filter((item) => { + const filteredData = deleteHistory?.data?.rows?.filter((item) => { // Filter by name (case insensitive) - const name = item.firstName; + const name = item?.country; const searchLower = searchTerm.toLowerCase(); const nameMatches = name.toLowerCase().includes(searchLower); return nameMatches; }); + console.log(deleteHistory); // ====================================================[Table Setup]================================================================ const tableHeadRow = [ "Sr No.", @@ -83,7 +90,7 @@ const DeletionHistory = () => { className="d-flex align-items-center web-text-small" fontWeight={'500'} > - {formatDate(item.RequestedOn)} + {formatDate(item.RequestOn)} ), "Client ID": ( @@ -144,13 +151,14 @@ const DeletionHistory = () => { ), "Status": ( - {item.status} + {item.deletionStatus} ), })); @@ -197,7 +205,7 @@ const DeletionHistory = () => { - {data?.data?.comment} - + Admin Comment