Skip to content

Commit

Permalink
chore: technical debt clearing - remove getServerSideProps for /event…
Browse files Browse the repository at this point in the history
…-types (#18733)

* chore: technical debt clearing - remove getServerSideProps for event-types

* refactor
  • Loading branch information
hbjORbj authored Jan 17, 2025
1 parent 6be69b8 commit 245196f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 26 deletions.
24 changes: 20 additions & 4 deletions apps/web/app/event-types/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { withAppDirSsr } from "app/WithAppDirSsr";
import type { PageProps } from "app/_types";
import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
import { cookies, headers } from "next/headers";
import { redirect } from "next/navigation";

import { getServerSideProps } from "@lib/event-types/getServerSideProps";
import { getServerSessionForAppDir } from "@calcom/features/auth/lib/get-server-session-for-app-dir";

import { buildLegacyCtx } from "@lib/buildLegacyCtx";

import { ssrInit } from "@server/lib/ssr";

import EventTypes from "~/event-types/views/event-types-listing-view";

Expand All @@ -12,6 +18,16 @@ export const generateMetadata = async () =>
(t) => t("event_types_page_subtitle")
);

const getData = withAppDirSsr(getServerSideProps);
const Page = async ({ params, searchParams }: PageProps) => {
const context = buildLegacyCtx(headers(), cookies(), params, searchParams);
const session = await getServerSessionForAppDir();
if (!session?.user?.id) {
redirect("/auth/login");
}

await ssrInit(context);

return <EventTypes />;
};

export default WithLayout({ getLayout: null, getData, Page: EventTypes })<"P">;
export default WithLayout({ ServerPage: Page })<"P">;
21 changes: 0 additions & 21 deletions apps/web/lib/event-types/getServerSideProps.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,6 @@ const InfiniteScrollMain = ({

const EventTypesPage: React.FC = () => {
const { t } = useLocale();
const searchParams = useSearchParams();
const { data: user } = useMeQuery();
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [_showProfileBanner, setShowProfileBanner] = useState(false);
Expand Down

0 comments on commit 245196f

Please sign in to comment.