-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e066d22
commit 01d25b9
Showing
6 changed files
with
96 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { useNavigate, useParams,useHistory } from 'react-router-dom'; | ||
import { useState, useEffect } from 'react'; | ||
import axiosInstance from './axiosInstance'; | ||
|
||
|
||
|
||
const ViewEvent = () => { | ||
const { id } = useParams<{ id: string }>(); | ||
const [eventData, setEventData] = useState<any>(null); | ||
const history = useHistory(); | ||
|
||
// const navigate = useNavigate(); | ||
useEffect(() => { | ||
const fetchEventData = async () => { | ||
try { | ||
const response = await axiosInstance.get(`/api/events/getSingleEventData?EventID=${id}`); | ||
console.log('Event data:', response.data); | ||
setEventData(response.data); | ||
} catch (error) { | ||
console.error('Error fetching event data:', error); | ||
} | ||
}; | ||
|
||
if (id) { | ||
fetchEventData(); | ||
} | ||
}, [id]); | ||
if (eventData === null) return <div>Loading...</div> | ||
return ( | ||
<div className='rounded-tl-2xl p-2 w-full min-h-screen bg-emerald-500'> | ||
<button onClick={()=>{ | ||
// navigate('/clubAdmin/events') | ||
history.push('/clubAdmin/events'); | ||
}} className='absolute top-6 right-8 p-2 bg-white text-black font-semibold rounded-md block'>{"<-- Back"}</button> | ||
|
||
ViewEvent | ||
<p>ID:{eventData.EventID}</p> | ||
<p> name: {eventData.EventName}</p> | ||
<p>Description: {eventData.Description}</p> | ||
<p>Location: {eventData.Location}</p> | ||
</div> | ||
) | ||
} | ||
|
||
export default ViewEvent |