diff --git a/src/Components/Banner/AddBanner.jsx b/src/Components/Banner/AddBanner.jsx
index 9c015bc..2a94ecb 100644
--- a/src/Components/Banner/AddBanner.jsx
+++ b/src/Components/Banner/AddBanner.jsx
@@ -28,6 +28,7 @@ import {
import { useNavigate } from "react-router-dom";
import Loader01 from "../../Components/Loaders/Loader01";
import Header from "../Header";
+import ToastBox from "../ToastBox";
const AddBanner = ({ createApi, navigateLink, title }) => {
const toast = useToast();
@@ -67,18 +68,18 @@ const AddBanner = ({ createApi, navigateLink, title }) => {
if (response?.data?.statusCode === 200) {
setIsLoading(false);
toast({
- title: response?.data?.message,
- status: "success",
- isClosable: true,
+ render: () => (
+
+ ),
});
reset();
navigate(navigateLink);
} else if (response?.data?.statusCode === 500) {
setIsLoading(false);
toast({
- title: response?.data?.message,
- status: "success",
- isClosable: true,
+ render: () => (
+
+ ),
});
}
})
diff --git a/src/Components/Banner/BannerEdit.jsx b/src/Components/Banner/BannerEdit.jsx
new file mode 100644
index 0000000..fef3bb5
--- /dev/null
+++ b/src/Components/Banner/BannerEdit.jsx
@@ -0,0 +1,8 @@
+
+const BannerEdit = ({title}) => {
+ return (
+
{title}
+ )
+}
+
+export default BannerEdit
\ No newline at end of file
diff --git a/src/Components/Banner/BannerTable.jsx b/src/Components/Banner/BannerTable.jsx
index bbaf007..bc9bff9 100644
--- a/src/Components/Banner/BannerTable.jsx
+++ b/src/Components/Banner/BannerTable.jsx
@@ -37,11 +37,15 @@ const BannerCommunity = ({
statusUpdateApi,
title,
addLink,
+ viewLink,
+ editLink
+
}) => {
// ====================================================[Hooks]===================================================================
const toast = useToast();
const [deleteAlert, setDeleteAlert] = useState(false);
const [actionId, setActionId] = useState(null);
+ const [actionStatus, setActionStatus] = useState(null);
const [deleteIsLoading, setDeleteIsLoading] = useState(false);
const [searchTerm, setSearchTerm] = useState("");
const [statusFilter, setStatusFilter] = useState("all");
@@ -56,24 +60,29 @@ const BannerCommunity = ({
// ====================================================[Functions]===================================================================
- const handleDelete = async (bannerId) => {
+ const handleDelete = async (bannerId, status) => {
+ if (status) {
+ return toast({
+ render: () => (
+
+ ),
+ });
+
+ }
try {
// Trigger the mutation
setDeleteIsLoading(true);
await deleteApi(bannerId)
.then((response) => {
// Handle the response here
- console.log("Mutation response:", response?.data?.statusCode);
- console.log("Mutation response:", response?.data?.message);
if (response?.data?.statusCode === 200) {
setDeleteIsLoading(false);
setDeleteAlert(false);
toast({
- title: response?.data?.message,
- status: "success",
- duration: 1000,
- isClosable: true,
+ render: () => (
+
+ ),
});
}
})
@@ -95,8 +104,8 @@ const BannerCommunity = ({
),
});
- }
-
+ }else{
+
try {
// Trigger the mutation
await statusUpdateApi({ id })
@@ -114,6 +123,8 @@ const BannerCommunity = ({
// Handle errors
console.error("Error updating community status:", error);
}
+ }
+
};
// ====================================================[Table Filter]================================================================
@@ -208,16 +219,17 @@ const BannerCommunity = ({
-
+
-
+