33 lines
853 B
TypeScript
33 lines
853 B
TypeScript
import PageContainer from '@/components/layout/page-container';
|
|
import { getSurveyByIdAction } from '@/feactures/surveys/actions/surveys-actions';
|
|
import { SurveyResponse } from '@/feactures/surveys/components/survey-response';
|
|
|
|
|
|
|
|
export default async function SurveyResponsePage({
|
|
params,
|
|
}: {
|
|
params: Promise<{ id: string }>
|
|
}) {
|
|
const { id } = await params; // You can still destructure id from params
|
|
|
|
if (!id || id === '') {
|
|
// Handle the case where no id is provided
|
|
return null;
|
|
}
|
|
|
|
// Call the function passing the dynamic id
|
|
const data = await getSurveyByIdAction(Number(id));
|
|
|
|
if (!data?.data) {
|
|
return <div>Encuesta no encontrada</div>;
|
|
}
|
|
|
|
return (
|
|
<PageContainer>
|
|
<div className="flex flex-1 flex-col space-y-4">
|
|
<SurveyResponse survey={data?.data} />
|
|
</div>
|
|
</PageContainer>
|
|
);
|
|
} |