added the routing for the refresh issue

This commit is contained in:
sumona-banerjeee
2026-03-09 17:06:06 +05:30
parent 4266c44cbf
commit 01c1117a0b
5 changed files with 445 additions and 103 deletions

View File

@@ -39,38 +39,13 @@ export default function ResultsPage() {
return
}
setSession(storedSession)
setVideoId(videoData.videoId)
setDetectionType(videoData.detectionType as DetectionType)
// Fetch detection results and video file
const fetchResults = async () => {
try {
// Fetch detection data
const response = await fetch(`${API_URL}/results/${videoData.videoId}`, {
headers: { "ngrok-skip-browser-warning": "true" }
})
if (!response.ok) {
throw new Error(`Failed to load results: ${response.status}`)
}
const data = await response.json()
setDetectionData(data as any)
// Retrieve video file from IndexedDB
const storedVideoFile = await getVideoFile(videoData.videoId)
if (storedVideoFile) {
setVideoFile(storedVideoFile)
}
} catch (err) {
setError(err instanceof Error ? err.message : "Failed to load results")
} finally {
setIsLoading(false)
}
// If we have a videoId, redirect to the dynamic results page
if (videoData.videoId) {
router.replace(`/results/${videoData.videoId}`)
return
}
fetchResults()
setSession(storedSession)
}, [router])
const handleNewAnalysis = async () => {