forked from calcom/cal.com
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5950c5a
commit 8393c8c
Showing
48 changed files
with
859 additions
and
1,182 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import type { GetStaticProps } from "next"; | ||
import { notFound, redirect } from "next/navigation"; | ||
|
||
import type { buildLegacyCtx } from "@lib/buildLegacyCtx"; | ||
|
||
export const withAppDirSsg = | ||
<T extends Record<string, any>>(getStaticProps: GetStaticProps<T>) => | ||
async (context: ReturnType<typeof buildLegacyCtx>) => { | ||
const ssgResponse = await getStaticProps(context); | ||
|
||
if ("redirect" in ssgResponse) { | ||
redirect(ssgResponse.redirect.destination); | ||
} | ||
|
||
if ("notFound" in ssgResponse) { | ||
notFound(); | ||
} | ||
|
||
const props = await Promise.resolve(ssgResponse.props); | ||
|
||
return { | ||
...ssgResponse.props, | ||
// includes dehydratedState required for future page trpcPropvider | ||
...("trpcState" in props && { dehydratedState: props.trpcState }), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import type { GetServerSideProps, GetServerSidePropsContext } from "next"; | ||
import { notFound, redirect } from "next/navigation"; | ||
|
||
export const withAppDirSsr = | ||
<T extends Record<string, any>>(getServerSideProps: GetServerSideProps<T>) => | ||
async (context: GetServerSidePropsContext) => { | ||
const ssrResponse = await getServerSideProps(context); | ||
|
||
if ("redirect" in ssrResponse) { | ||
redirect(ssrResponse.redirect.destination); | ||
} | ||
|
||
if ("notFound" in ssrResponse) { | ||
notFound(); | ||
} | ||
|
||
const props = await Promise.resolve(ssrResponse.props); | ||
|
||
return { | ||
...props, | ||
// includes dehydratedState required for future page trpcPropvider | ||
...("trpcState" in props && { dehydratedState: props.trpcState }), | ||
}; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.