Fix evaluation submission redirect to assignments page
The previous code incorrectly tried to extract a project ID from the assignment ID by splitting on '-', which doesn't work with CUIDs. Now redirects to /jury/assignments with a success toast message after submitting an evaluation. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -37,6 +37,7 @@ import {
|
|||||||
ThumbsDown,
|
ThumbsDown,
|
||||||
} from 'lucide-react'
|
} from 'lucide-react'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
|
import { toast } from 'sonner'
|
||||||
|
|
||||||
// Define criterion type from the evaluation form JSON
|
// Define criterion type from the evaluation form JSON
|
||||||
interface Criterion {
|
interface Criterion {
|
||||||
@@ -186,8 +187,10 @@ export function EvaluationForm({
|
|||||||
// Invalidate queries and redirect
|
// Invalidate queries and redirect
|
||||||
utils.assignment.myAssignments.invalidate()
|
utils.assignment.myAssignments.invalidate()
|
||||||
|
|
||||||
|
toast.success('Evaluation submitted successfully!')
|
||||||
|
|
||||||
startTransition(() => {
|
startTransition(() => {
|
||||||
router.push(`/jury/projects/${assignmentId.split('-')[0]}/evaluation`)
|
router.push('/jury/assignments')
|
||||||
router.refresh()
|
router.refresh()
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user