Files
calendar/packages/features/ee/organizations/pages/settings/getServerSidePropsMembers.tsx
T
623f0c7d93 fix: visiting organization without access shows empty page (#15103)
* fix : visiting organization without access shows empty page

* feat: add serversideprops for navigating user before page load

* Update packages/features/ee/organizations/pages/settings/getServerSidePropsMembers.tsx

* fix: workaround e2e fix

---------

Co-authored-by: Shaik-Sirajuddin <sirajudddinshaik30@gmail.com>
Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
Co-authored-by: Amit Sharma <74371312+Amit91848@users.noreply.github.com>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: Hariom <hariombalhara@gmail.com>
Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
2024-08-24 09:05:50 +00:00

36 lines
816 B
TypeScript

import type { GetServerSidePropsContext } from "next";
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
import type { inferSSRProps } from "@calcom/types/inferSSRProps";
export type PageProps = inferSSRProps<typeof getServerSidePropsForMembers>;
export const getServerSidePropsForMembers = async function getServerSidePropsForMembers({
req,
res,
}: GetServerSidePropsContext) {
const session = await getServerSession({ req, res });
if (!session || !session.user) {
return {
redirect: {
permanent: false,
destination: "/auth/login",
},
};
}
if (!session.user.profile?.organizationId) {
return {
redirect: {
permanent: false,
destination: "/enterprise",
},
};
}
return {
props: {},
};
};