mirror of
https://github.com/WDI-Ideas/rubix-admin-panel.git
synced 2026-04-27 19:35:50 +00:00
updated
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -283,6 +283,7 @@ const BlogsAndArticles = () => {
|
||||
currentPage={currentPage}
|
||||
setCurrentPage={setCurrentPage}
|
||||
totalPages={blog?.data?.data?.totalItems}
|
||||
noDataTitle={'blog'}
|
||||
/>
|
||||
<CustomAlertDialog
|
||||
onClose={() => setDeleteAlert(false)}
|
||||
|
||||
@@ -249,6 +249,7 @@ const News = () => {
|
||||
currentPage={currentPage}
|
||||
setCurrentPage={setCurrentPage}
|
||||
totalPages={news?.data?.data?.totalPages}
|
||||
noDataTitle={'news'}
|
||||
/>
|
||||
<CustomAlertDialog
|
||||
onClose={() => setDeleteAlert(false)}
|
||||
|
||||
@@ -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'}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -254,6 +254,7 @@ const Usecase = () => {
|
||||
currentPage={currentPage}
|
||||
setCurrentPage={setCurrentPage}
|
||||
totalPages={useCase?.data?.data?.totalPages}
|
||||
noDataTitle={'usecase'}
|
||||
/>
|
||||
<CustomAlertDialog
|
||||
onClose={() => setDeleteAlert(false)}
|
||||
|
||||
@@ -236,6 +236,7 @@ const Videos = () => {
|
||||
currentPage={currentPage}
|
||||
setCurrentPage={setCurrentPage}
|
||||
totalPages={videos?.data?.data?.data?.totalPages}
|
||||
noDataTitle={'video'}
|
||||
/>
|
||||
<CustomAlertDialog
|
||||
onClose={() => setDeleteAlert(false)}
|
||||
|
||||
@@ -235,6 +235,7 @@ const Whitepapers = () => {
|
||||
currentPage={currentPage}
|
||||
setCurrentPage={setCurrentPage}
|
||||
totalPages={whitePaper?.data?.data?.data?.totalPages}
|
||||
noDataTitle={'whitepaper'}
|
||||
/>
|
||||
<CustomAlertDialog
|
||||
onClose={() => setDeleteAlert(false)}
|
||||
|
||||
@@ -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,
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user