diff --git a/app/components/conferences/admin/dashboard.js b/app/components/conferences/admin/dashboard.js index 83a2339b..8b9bcbd5 100644 --- a/app/components/conferences/admin/dashboard.js +++ b/app/components/conferences/admin/dashboard.js @@ -5,12 +5,12 @@ import { BiEdit } from "react-icons/bi"; import { MdDelete } from "react-icons/md"; import { deleteEvent, - getUserEventDeatils, + getUserEventDeatilsByState, } from "../../../lib/conferences/eventCall"; import styles from "../../../styles/event.module.css"; import toast, { Toaster } from 'react-hot-toast'; -export const EventDashBoard = () => { +export const EventDashBoard = ({state}) => { const [eventData, setEventData] = useState(null); let authCookie = Cookies.get("event_auth"); if (authCookie) { @@ -20,9 +20,10 @@ export const EventDashBoard = () => { const fetchEventDeatils = async () => { try { if (!eventData) { - const eventres = await getUserEventDeatils( + const eventres = await getUserEventDeatilsByState( authCookie.jwtInfo.identity, - authCookie.access_token + authCookie.access_token, + state ); setEventData(eventres.data); } @@ -36,9 +37,10 @@ export const EventDashBoard = () => { const handleDelete = async (e) => { try { await deleteEvent(e.target.id, authCookie?.access_token); - const eventres = await getUserEventDeatils( + const eventres = await getUserEventDeatilsByState( authCookie.jwtInfo.identity, - authCookie.access_token + authCookie.access_token, + state ); toast.success('Event deleted successfully',{ duration:2000 diff --git a/app/lib/conferences/eventCall.js b/app/lib/conferences/eventCall.js index 590f0c38..3cba0855 100644 --- a/app/lib/conferences/eventCall.js +++ b/app/lib/conferences/eventCall.js @@ -148,12 +148,12 @@ export const getAllEvents = async (eid) => { return res; }; -export const getUserEventDeatils = async (uid, auth) => { +export const getUserEventDeatilsByState = async (uid, auth,state) => { const headers = { Accept: "application/vnd.api+json", Authorization: `JWT ${auth}`, }; - const res = await axios.get(`${eventUrl}/v1/users/${uid}/events`, { + const res = await axios.get(`${eventUrl}/v1/users/${uid}/events?filter=[{"name" : "state","op" : "eq","val" : "${state}"}]`, { headers: headers, }); return res; diff --git a/app/pages/conferences/admin/dashboard.js b/app/pages/conferences/admin/dashboard.js deleted file mode 100644 index e63acced..00000000 --- a/app/pages/conferences/admin/dashboard.js +++ /dev/null @@ -1,38 +0,0 @@ -import Head from "next/head"; -import { Stack } from "react-bootstrap"; -import { EventCreate } from "../../../components/conferences/create/EventCreate"; -import { ssrVerifyAdmin } from "../../../components/conferences/auth/AuthSuperProfileHelper"; -import { fetchAPI } from "../../../lib/api"; -import { unsignCook } from "../../../lib/conferences/eventCall"; -import { EventDashBoard } from "../../../components/conferences/admin/dashboard"; - -function EventDashBoardPage() { - return ( -