Skip to content

Scheduling infrastructure for absolutely everyone.

chore: migrate /auth/setup (#18941)

Benny Joo9ad45bb47787
diff --git a/apps/web/app/(use-page-wrapper)/auth/setup/page.tsx b/apps/web/app/(use-page-wrapper)/auth/setup/page.tsx
new file mode 100644
index 00000000000..3115454d775
--- /dev/null
+++ b/apps/web/app/(use-page-wrapper)/auth/setup/page.tsx
@@ -0,0 +1,19 @@
+import { withAppDirSsr } from "app/WithAppDirSsr";
+import type { PageProps as ServerPageProps } from "app/_types";
+import { cookies, headers } from "next/headers";
+
+import { buildLegacyCtx } from "@lib/buildLegacyCtx";
+
+import { getServerSideProps } from "@server/lib/setup/getServerSideProps";
+
+import Setup from "~/auth/setup-view";
+import type { PageProps as ClientPageProps } from "~/auth/setup-view";
+
+const getData = withAppDirSsr<ClientPageProps>(getServerSideProps);
+
+const ServerPage = async ({ params, searchParams }: ServerPageProps) => {
+ const props = await getData(buildLegacyCtx(headers(), cookies(), params, searchParams));
+ return <Setup {...props} />;
+};
+
+export default ServerPage;
diff --git a/apps/web/app/future/auth/setup/page.tsx b/apps/web/app/future/auth/setup/page.tsx
deleted file mode 100644
index 5f4d478e455..00000000000
--- a/apps/web/app/future/auth/setup/page.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import { withAppDirSsr } from "app/WithAppDirSsr";
-import { WithLayout } from "app/layoutHOC";
-
-import { getServerSideProps } from "@server/lib/setup/getServerSideProps";
-
-import Setup from "~/auth/setup-view";
-import type { PageProps } from "~/auth/setup-view";
-
-export default WithLayout({
- getLayout: null,
- Page: Setup,
- getData: withAppDirSsr<PageProps>(getServerSideProps),
-})<"P">;
diff --git a/apps/web/middleware.ts b/apps/web/middleware.ts
index c31bcfd3d1d..e67f0948446 100644
--- a/apps/web/middleware.ts
+++ b/apps/web/middleware.ts
@@ -163,6 +163,7 @@ export const config = {
"/auth/verify-email-change",
"/auth/verify-email",
"/auth/verify",
+ "/auth/setup",
/**
* Paths required by routingForms.handle
*/
diff --git a/apps/web/pages/auth/setup/index.tsx b/apps/web/pages/auth/setup/index.tsx
deleted file mode 100644
index 8f0a0e42fc5..00000000000
--- a/apps/web/pages/auth/setup/index.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-"use client";
-
-import { useLocale } from "@calcom/lib/hooks/useLocale";
-import { Meta } from "@calcom/ui";
-
-import PageWrapper from "@components/PageWrapper";
-
-import { getServerSideProps } from "@server/lib/setup/getServerSideProps";
-
-import type { PageProps } from "~/auth/setup-view";
-import Setup from "~/auth/setup-view";
-
-const Page = (props: PageProps) => {
- const { t } = useLocale();
- return (
- <>
- <Meta title={t("setup")} description={t("setup_description")} />
- <Setup {...props} />
- </>
- );
-};
-
-Page.PageWrapper = PageWrapper;
-export default Page;
-
-export { getServerSideProps };
diff --git a/apps/web/server/lib/setup/getServerSideProps.tsx b/apps/web/server/lib/setup/getServerSideProps.tsx
index dbc0ccb6ccf..b13b91205c3 100644
--- a/apps/web/server/lib/setup/getServerSideProps.tsx
+++ b/apps/web/server/lib/setup/getServerSideProps.tsx
@@ -17,11 +17,8 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
if (session?.user.role && session?.user.role !== UserPermissionRole.ADMIN) {
return {
- redirect: {
- destination: `/404`,
- permanent: false,
- },
- };
+ notFound: true,
+ } as const;
}
const deploymentKey = await prisma.deployment.findUnique({