diff --git a/src/app/(main)/dashboard/_components/new-form-dialog.tsx b/src/app/(main)/dashboard/_components/new-form-dialog.tsx index b98c80d..d257398 100644 --- a/src/app/(main)/dashboard/_components/new-form-dialog.tsx +++ b/src/app/(main)/dashboard/_components/new-form-dialog.tsx @@ -40,6 +40,7 @@ const FormSchema = z.object({ message: "Form title is required.", }), returnUrl: z.string().optional(), + description: z.string().optional(), }); export function CreateFormDialog() { @@ -48,6 +49,7 @@ export function CreateFormDialog() { resolver: zodResolver(FormSchema), defaultValues: { name: "", + description: "", returnUrl: "", }, }); @@ -61,6 +63,8 @@ export function CreateFormDialog() { await createNewForm( { title: data.name, + description: data.description, + returningUrl: data.returnUrl, }, { onSuccess: ({ id }) => { @@ -106,7 +110,21 @@ export function CreateFormDialog() { Name - + + + + + )} + /> + + ( + + Description + + diff --git a/src/app/s/[formId]/page.tsx b/src/app/s/[formId]/page.tsx index c7fb2cc..033e64c 100644 --- a/src/app/s/[formId]/page.tsx +++ b/src/app/s/[formId]/page.tsx @@ -10,6 +10,8 @@ export default async function FormCompletedPage({ }) { const form = await api.form.hasReturiningUrl.query({ formId: params.formId }); + console.log(form); + if (!form) { return (
diff --git a/src/server/api/routers/form.ts b/src/server/api/routers/form.ts index d8240f9..f0d6c20 100644 --- a/src/server/api/routers/form.ts +++ b/src/server/api/routers/form.ts @@ -40,8 +40,9 @@ export const formRouter = createTRPCRouter({ create: protectedProcedure .input( z.object({ - title: z.string().min(3).max(255), + title: z.string().min(1).max(255), description: z.string().optional(), + returningUrl: z.string().optional(), }), ) .mutation(async ({ ctx, input }) => { @@ -53,6 +54,7 @@ export const formRouter = createTRPCRouter({ title: input.title, description: input.description, updatedAt: new Date(), + returnUrl: input.returningUrl, }); return { id };