Add authentication #17

Manually merged
Webmaster merged 225 commits from auth into main 2025-03-08 10:37:06 +00:00
2 changed files with 21 additions and 2 deletions
Showing only changes of commit b0aa2020c4 - Show all commits

View file

@ -152,10 +152,13 @@ try {
</div> </div>
<script> <script>
// Refresh the page when the user navigates back to it // Remove the visibilitychange event listener that causes full page refresh
// Instead, we'll use a more efficient approach to refresh data only when needed
document.addEventListener("visibilitychange", () => { document.addEventListener("visibilitychange", () => {
if (document.visibilityState === "visible") { if (document.visibilityState === "visible") {
window.location.reload(); // Instead of reloading the entire page, dispatch a custom event
// that components can listen for to refresh their data
document.dispatchEvent(new CustomEvent("dashboardTabVisible"));
} }
}); });

View file

@ -303,6 +303,22 @@ const EventRequestManagementTable = ({ eventRequests: initialEventRequests }: Ev
refreshEventRequests(); refreshEventRequests();
}, []); }, []);
// Listen for tab visibility changes and refresh data when tab becomes visible
useEffect(() => {
const handleTabVisible = () => {
console.log("Tab became visible, refreshing event requests...");
refreshEventRequests();
};
// Add event listener for custom dashboardTabVisible event
document.addEventListener("dashboardTabVisible", handleTabVisible);
// Clean up event listener on component unmount
return () => {
document.removeEventListener("dashboardTabVisible", handleTabVisible);
};
}, []);
if (filteredRequests.length === 0) { if (filteredRequests.length === 0) {
return ( return (
<motion.div <motion.div