diff --git a/apps/web/app/routing-forms/[...pages]/page.tsx b/apps/web/app/routing-forms/[...pages]/page.tsx new file mode 100644 index 0000000000..ead2d36f73 --- /dev/null +++ b/apps/web/app/routing-forms/[...pages]/page.tsx @@ -0,0 +1,16 @@ +import type { PageProps } from "app/_types"; +import { redirect } from "next/navigation"; +import z from "zod"; + +const paramsSchema = z + .object({ + pages: z.array(z.string()), + }) + .catch({ + pages: [], + }); + +export default function RoutingForms({ params }: PageProps) { + const { pages } = paramsSchema.parse(params); + redirect(`/apps/routing-forms/${pages.length ? pages.join("/") : ""}`); +} diff --git a/apps/web/app/routing-forms/page.tsx b/apps/web/app/routing-forms/page.tsx new file mode 100644 index 0000000000..ba222ba476 --- /dev/null +++ b/apps/web/app/routing-forms/page.tsx @@ -0,0 +1,7 @@ +import { redirect } from "next/navigation"; + +const Page = () => { + redirect("/apps/routing-forms/forms"); +}; + +export default Page; diff --git a/apps/web/pages/routing-forms/[...pages].tsx b/apps/web/pages/routing-forms/[...pages].tsx deleted file mode 100644 index 13576b185a..0000000000 --- a/apps/web/pages/routing-forms/[...pages].tsx +++ /dev/null @@ -1,25 +0,0 @@ -import type { GetServerSidePropsContext } from "next"; -import z from "zod"; - -const paramsSchema = z - .object({ - pages: z.array(z.string()), - }) - .catch({ - pages: [], - }); - -export default function RoutingForms() { - return null; -} - -export const getServerSideProps = (context: GetServerSidePropsContext) => { - const { pages } = paramsSchema.parse(context.params); - - return { - redirect: { - destination: `/apps/routing-forms/${pages.length ? pages.join("/") : ""}`, - permanent: false, - }, - }; -}; diff --git a/apps/web/pages/routing-forms/index.tsx b/apps/web/pages/routing-forms/index.tsx deleted file mode 100644 index c2032de1dd..0000000000 --- a/apps/web/pages/routing-forms/index.tsx +++ /dev/null @@ -1,12 +0,0 @@ -export default function RoutingFormsIndex() { - return null; -} - -export const getServerSideProps = () => { - return { - redirect: { - destination: `/apps/routing-forms/forms`, - permanent: false, - }, - }; -};