Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/web/src/app/s/[formId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default async function FormCompletedPage({
params: Promise<{ formId: string }>;
}) {
const { formId } = await params;
const form = await api.form.hasReturningUrl({ formId });
const form = await api.form.getReturnUrl({ formId });

if (!form) {
return (
Expand Down
15 changes: 7 additions & 8 deletions packages/api/routers/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,14 @@ export const formRouter = createTRPCRouter({
}),
),

hasReturningUrl: protectedProcedure
.input(
z.object({
formId: z.string(),
}),
)
getReturnUrl: publicProcedure
.input(z.object({ formId: z.string() }))
.query(async ({ ctx, input }) => {
const form = await assertFormOwnership(ctx, input.formId);
return { returnUrl: form.returnUrl };
const form = await ctx.db.query.forms.findFirst({
where: (table) => eq(table.id, input.formId),
columns: { returnUrl: true },
});
return { returnUrl: form?.returnUrl ?? null };
}),

formSubmissions: protectedProcedure
Expand Down
Loading