diff --git a/src/client/routes/survey/add.tsx b/src/client/routes/survey/add.tsx index 466e29f..8808273 100644 --- a/src/client/routes/survey/add.tsx +++ b/src/client/routes/survey/add.tsx @@ -26,9 +26,8 @@ function PageComponent() { const onSubmit = useEvent(async (values: SurveyEditFormValues) => { const res = await createMutation.mutateAsync({ + ...values, workspaceId, - name: values.name, - payload: values.payload, }); utils.survey.all.refetch(); diff --git a/src/client/utils/survey.spec.ts b/src/client/utils/survey.spec.ts index 0381b4e..32bb934 100644 --- a/src/client/utils/survey.spec.ts +++ b/src/client/utils/survey.spec.ts @@ -17,8 +17,6 @@ describe('survey', () => { }, ], }, - createdAt: '', - updatedAt: '', }) ).matchSnapshot(); }); diff --git a/src/client/utils/survey.ts b/src/client/utils/survey.ts index 1cd3335..b74cd96 100644 --- a/src/client/utils/survey.ts +++ b/src/client/utils/survey.ts @@ -5,7 +5,13 @@ import { AppRouterOutput } from '@/api/trpc'; */ export function generateSurveyExampleCode( host: string, - info?: AppRouterOutput['survey']['get'] + info: + | Pick< + NonNullable, + 'id' | 'name' | 'workspaceId' | 'payload' + > + | null + | undefined ): string { const fields = info?.payload.items ?? [];