added the routing for the refresh issue
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user