feat: add route constant
This commit is contained in:
@@ -20,6 +20,8 @@ import { DetectionData, DetectionType } from "@/lib/types"
|
||||
const API_URL = process.env.NEXT_PUBLIC_API_URL
|
||||
|
||||
|
||||
import { ROUTES } from "@/utils/routes"
|
||||
|
||||
export default function ResultsPage() {
|
||||
const router = useRouter()
|
||||
const [session, setSession] = useState<SessionContext | null>(null)
|
||||
@@ -36,13 +38,13 @@ export default function ResultsPage() {
|
||||
const videoData = loadVideoData()
|
||||
|
||||
if (!isSessionValid(storedSession) || !videoData) {
|
||||
router.replace("/new-analysis")
|
||||
router.replace(ROUTES.NEW_ANALYSIS)
|
||||
return
|
||||
}
|
||||
|
||||
// If we have a videoId, redirect to the dynamic results page
|
||||
if (videoData.videoId) {
|
||||
router.replace(`/results/${videoData.videoId}`)
|
||||
router.replace(`${ROUTES.RESULTS}/${videoData.videoId}`)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -59,11 +61,11 @@ export default function ResultsPage() {
|
||||
}
|
||||
}
|
||||
clearSession()
|
||||
router.push("/new-analysis")
|
||||
router.push(ROUTES.NEW_ANALYSIS)
|
||||
}
|
||||
|
||||
const handleBackToUpload = () => {
|
||||
router.push("/upload")
|
||||
router.push(ROUTES.UPLOAD)
|
||||
}
|
||||
|
||||
const getTitle = () => {
|
||||
|
||||
Reference in New Issue
Block a user