* feat(web): improve session retrieval performance Switch to using `getServerSession` which avoids a HTTP round trip to retrieve session details. Additionally, migrate deprecated `app/lib/auth` calls to to `@calcom/lib` package. * fix: update failing test and lint * Consolidates auth code in features * Update yarn.lock * Update packages/trpc/server/createContext.ts * Oopsie --------- Co-authored-by: zomars <zomars@me.com>
20 lines
530 B
TypeScript
20 lines
530 B
TypeScript
import type { GetServerSidePropsContext } from "next";
|
|
|
|
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
|
|
|
|
function RedirectPage() {
|
|
return;
|
|
}
|
|
|
|
export async function getServerSideProps({ req, res }: GetServerSidePropsContext) {
|
|
const session = await getServerSession({ req, res });
|
|
|
|
if (!session?.user?.id) {
|
|
return { redirect: { permanent: false, destination: "/auth/login" } };
|
|
}
|
|
|
|
return { redirect: { permanent: false, destination: "/event-types" } };
|
|
}
|
|
|
|
export default RedirectPage;
|