chore: migrate /auth/setup (#18941)
This commit is contained in:
1 parent
a1e4959fb7
commit
9ad45bb477
5 files changed
+22
-44
No files matched your search
@@ -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;
|
||||
@@ -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">;
|
||||
@@ -163,6 +163,7 @@ export const config = {
|
||||
"/auth/verify-email-change",
|
||||
"/auth/verify-email",
|
||||
"/auth/verify",
|
||||
"/auth/setup",
|
||||
/**
|
||||
* Paths required by routingForms.handle
|
||||
*/
|
||||
|
||||
@@ -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 };
|
||||
@@ -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({
|
||||
|
||||
Reference in new issue
Block a user