diff --git a/src/app/s/[surveyId]/layout.tsx b/src/app/s/[surveyId]/layout.tsx index cc44648..11a396e 100644 --- a/src/app/s/[surveyId]/layout.tsx +++ b/src/app/s/[surveyId]/layout.tsx @@ -26,7 +26,7 @@ export async function generateMetadata( title, openGraph: { description, - images: [thumbnail, ...previousImages], + images: [thumbnail ?? '/path/to/default-image.png', ...previousImages], // thumbnail이 null인 경우 기본 이미지 사용 }, }; } diff --git a/src/components/management/result/PieChartComponent.tsx b/src/components/management/result/PieChartComponent.tsx index 6c45642..ebe4b97 100644 --- a/src/components/management/result/PieChartComponent.tsx +++ b/src/components/management/result/PieChartComponent.tsx @@ -61,10 +61,12 @@ export default function PieChartComponent({ responses }: { responses: Response[] callbacks: { label: (context) => { const value = context.parsed; - const total = context.chart.data.datasets[context.datasetIndex].data.reduce( - (acc: number, val: number) => acc + val, - 0 - ); + const total = (context.chart.data.datasets[0].data as number[]).reduce((acc, val) => { + if (typeof val === 'number') { + return acc + val; + } + return acc; + }, 0); const percentage = ((value / total) * 100).toFixed(1); return ` ${value} (${percentage}%)`; }, diff --git a/src/components/mypage/SurveyCreateButton.tsx b/src/components/mypage/SurveyCreateButton.tsx index 101e412..88476b5 100644 --- a/src/components/mypage/SurveyCreateButton.tsx +++ b/src/components/mypage/SurveyCreateButton.tsx @@ -9,17 +9,14 @@ export default function SurveyCreateButton() { const mutation = useCreateSurvey(); async function createNewSurvey() { - mutation.mutate( - {}, - { - onSuccess: (data) => { - nextRouter.push(`/workbench/${data.surveyId}`); - }, - onError: (error) => { - showToast('error', (error.cause as ErrorCause).message); - }, - } - ); + mutation.mutate(undefined, { + onSuccess: (data) => { + nextRouter.push(`/workbench/${data.surveyId}`); + }, + onError: (error) => { + showToast('error', (error.cause as ErrorCause).message); + }, + }); } return (