1
- import { withAppDirSsr } from "app/WithAppDirSsr " ;
1
+ import type { PageProps } from "app/_types " ;
2
2
import { _generateMetadata } from "app/_utils" ;
3
3
import { WithLayout } from "app/layoutHOC" ;
4
+ import { cookies , headers } from "next/headers" ;
5
+ import { redirect } from "next/navigation" ;
4
6
5
- import { getServerSideProps } from "@lib/event-types/getServerSideProps" ;
7
+ import { getServerSessionForAppDir } from "@calcom/features/auth/lib/get-server-session-for-app-dir" ;
8
+
9
+ import { buildLegacyCtx } from "@lib/buildLegacyCtx" ;
10
+
11
+ import { ssrInit } from "@server/lib/ssr" ;
6
12
7
13
import EventTypes from "~/event-types/views/event-types-listing-view" ;
8
14
@@ -12,6 +18,16 @@ export const generateMetadata = async () =>
12
18
( t ) => t ( "event_types_page_subtitle" )
13
19
) ;
14
20
15
- const getData = withAppDirSsr ( getServerSideProps ) ;
21
+ const Page = async ( { params, searchParams } : PageProps ) => {
22
+ const context = buildLegacyCtx ( headers ( ) , cookies ( ) , params , searchParams ) ;
23
+ const session = await getServerSessionForAppDir ( ) ;
24
+ if ( ! session ?. user ?. id ) {
25
+ redirect ( "/auth/login" ) ;
26
+ }
27
+
28
+ await ssrInit ( context ) ;
29
+
30
+ return < EventTypes /> ;
31
+ } ;
16
32
17
- export default WithLayout ( { getLayout : null , getData , Page : EventTypes } ) < "P" > ;
33
+ export default WithLayout ( { ServerPage : Page } ) < "P" > ;
0 commit comments