This commit is contained in:
2024-05-23 19:31:47 +05:30
parent 1b2ee12307
commit 97d05626fd
8 changed files with 21 additions and 5 deletions

View File

@@ -22,7 +22,8 @@ const TabularView = ({
setCurrentPage,
pageSize,
setPageSize,
totalPages
totalPages,
noDataTitle
}) => {
const [displayRange, setDisplayRange] = useState({
start: TABLE_PAGINATION?.page,
@@ -126,7 +127,7 @@ const TabularView = ({
{/* ====================================================[ Table ]================================================================ */}
<DataTable
emptyMessage={"We don't have any blog for this author"}
emptyMessage={`We don't have any ${noDataTitle} `}
tableHeadRow={tableHeadRow}
data={extractedArray}
isLoading={apiData?.isLoading}

View File

@@ -283,6 +283,7 @@ const BlogsAndArticles = () => {
currentPage={currentPage}
setCurrentPage={setCurrentPage}
totalPages={blog?.data?.data?.totalItems}
noDataTitle={'blog'}
/>
<CustomAlertDialog
onClose={() => setDeleteAlert(false)}

View File

@@ -249,6 +249,7 @@ const News = () => {
currentPage={currentPage}
setCurrentPage={setCurrentPage}
totalPages={news?.data?.data?.totalPages}
noDataTitle={'news'}
/>
<CustomAlertDialog
onClose={() => setDeleteAlert(false)}

View File

@@ -14,6 +14,7 @@ import {
import { OPACITY_ON_LOAD } from "../../Layout/animations";
import { TABLE_PAGINATION } from "../../Constants/Paginations";
import {
useDeletePolicyMutation,
useDeleteWhitepaperMutation,
useGetPolicyQuery,
useGetWhitePaperQuery,
@@ -52,7 +53,7 @@ const Policy = () => {
size: pageSize,
});
const [deleteWhitepaper] = useDeleteWhitepaperMutation();
const [deletePolicy] = useDeletePolicyMutation();
const [updateWhitepaperStatus] = useUpdateWhitepaperStatusMutation();
const filteredData = policy?.data?.data?.rows?.filter((item) => {
@@ -164,7 +165,7 @@ const Policy = () => {
try {
// Trigger the mutation
setDeleteIsLoading(true);
await deleteWhitepaper(communityId)
await deletePolicy(communityId)
.then((response) => {
// Handle the response here
console.log("Mutation response:", response?.data?.statusCode);
@@ -225,7 +226,7 @@ const Policy = () => {
return (
<>
<TabularView
title={"policy"}
title={"Policy"}
btnTitle={"Create policy"}
link={"/policy/add-policy"}
@@ -243,6 +244,7 @@ const Policy = () => {
currentPage={currentPage}
setCurrentPage={setCurrentPage}
totalPages={policy?.data?.data?.totalPages}
noDataTitle={'policy'}

View File

@@ -254,6 +254,7 @@ const Usecase = () => {
currentPage={currentPage}
setCurrentPage={setCurrentPage}
totalPages={useCase?.data?.data?.totalPages}
noDataTitle={'usecase'}
/>
<CustomAlertDialog
onClose={() => setDeleteAlert(false)}

View File

@@ -236,6 +236,7 @@ const Videos = () => {
currentPage={currentPage}
setCurrentPage={setCurrentPage}
totalPages={videos?.data?.data?.data?.totalPages}
noDataTitle={'video'}
/>
<CustomAlertDialog
onClose={() => setDeleteAlert(false)}

View File

@@ -235,6 +235,7 @@ const Whitepapers = () => {
currentPage={currentPage}
setCurrentPage={setCurrentPage}
totalPages={whitePaper?.data?.data?.data?.totalPages}
noDataTitle={'whitepaper'}
/>
<CustomAlertDialog
onClose={() => setDeleteAlert(false)}

View File

@@ -577,6 +577,13 @@ export const rubixApi = createApi({
query: () => "/admin/policy",
providesTags: ["getPolicy"],
}),
deletePolicy: builder.mutation({
query: (id) => ({
url: `/admin/policy/${id}`,
method: "DELETE",
}),
invalidatesTags: ["getPolicy"],
}),
}),
@@ -677,6 +684,7 @@ export const {
useGetPolicyQuery,
useDeletePolicyMutation,