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 <[email protected]> Co-authored-by: Anik Dhabal Babu <[email protected]> Co-authored-by: Amit Sharma <[email protected]> Co-authored-by: Keith Williams <[email protected]> Co-authored-by: Udit Takkar <[email protected]> Co-authored-by: Hariom <[email protected]> Co-authored-by: Carina Wollendorfer <[email protected]> Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
2 files changed
+41
-1
No files matched your search
@@ -0,0 +1,35 @@
|
||||
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: {},
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user