mirror of
https://github.com/mudabbir-ahmad/peworkshop.git
synced 2026-10-08 03:50:21 +00:00
issues regarding the map and hunt stopping have been fixed. leaderboard page needs to be integrated and a clues should be added to be properly processed. after that the css for the application should be developed.
This commit is contained in:
1 parent
c79a9636a7
commit
e7ad53643c
12 files changed
+855
-187
No files matched your search
@@ -9,6 +9,49 @@ export default function HuntNotStarted() {
|
||||
const searchParams = useSearchParams();
|
||||
const teamId = searchParams.get("teamId");
|
||||
|
||||
// Add aggressive hunt status checking
|
||||
useEffect(() => {
|
||||
let redirectAttempted = false;
|
||||
|
||||
// Function to check hunt status
|
||||
async function checkHuntStatus() {
|
||||
if (redirectAttempted) return;
|
||||
|
||||
try {
|
||||
const timestamp = new Date().getTime();
|
||||
const response = await fetch(`/api/hunt-status?t=${timestamp}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Cache-Control": "no-store, no-cache, must-revalidate",
|
||||
Pragma: "no-cache",
|
||||
},
|
||||
credentials: "include",
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const data = await response.json();
|
||||
|
||||
// If hunt becomes active while on this page, immediately redirect to map
|
||||
if (data.active) {
|
||||
console.log("Hunt now active! Redirecting to map page");
|
||||
redirectAttempted = true;
|
||||
window.location.replace("/map");
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Error checking hunt status:", err);
|
||||
}
|
||||
}
|
||||
|
||||
// Check immediately and every 500ms
|
||||
checkHuntStatus();
|
||||
const intervalId = setInterval(checkHuntStatus, 500);
|
||||
|
||||
return () => clearInterval(intervalId);
|
||||
}, []);
|
||||
|
||||
// Existing countdown effect
|
||||
useEffect(() => {
|
||||
// Countdown timer
|
||||
if (countdown > 0) {
|
||||
|
||||
Reference in new issue
Block a user