28 lines
723 B
TypeScript
28 lines
723 B
TypeScript
'use client'
|
|
|
|
import { SurveyResponse } from '@/feactures/surveys/components/survey-response';
|
|
import { useSurveysByIdQuery } from '@/feactures/surveys/hooks/use-query-surveys';
|
|
|
|
import { notFound, useParams } from 'next/navigation';
|
|
|
|
|
|
export default function SurveyPage() {
|
|
const params = useParams();
|
|
const surveyId = params?.id as string | undefined;
|
|
|
|
|
|
if (!surveyId || surveyId === '') {
|
|
notFound();
|
|
}
|
|
|
|
const { data: survey, isLoading } = useSurveysByIdQuery(Number(surveyId));
|
|
console.log('🎯 useSurveysByIdQuery ejecutado, data:', survey, 'isLoading:', isLoading);
|
|
|
|
if (!survey?.data || !survey?.data.published) {
|
|
notFound();
|
|
}
|
|
|
|
return (
|
|
<SurveyResponse survey={survey?.data} />
|
|
);
|
|
} |