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>
This commit is contained in:
co-authored by
Shaik-Sirajuddin
Anik Dhabal Babu
Amit Sharma
Keith Williams
Udit Takkar
Hariom
Carina Wollendorfer
Peer Richelsen
parent
c67877cc51
commit
623f0c7d93
@@ -3,7 +3,12 @@ import MembersView from "@calcom/features/ee/organizations/pages/settings/member
|
||||
import type { CalPageWrapper } from "@components/PageWrapper";
|
||||
import PageWrapper from "@components/PageWrapper";
|
||||
|
||||
const Page = MembersView as CalPageWrapper;
|
||||
export {
|
||||
getServerSidePropsForMembers as getServerSideProps,
|
||||
type PageProps,
|
||||
} from "@calcom/features/ee/organizations/pages/settings/getServerSidePropsMembers";
|
||||
|
||||
const Page = MembersView as unknown as CalPageWrapper;
|
||||
Page.PageWrapper = PageWrapper;
|
||||
|
||||
export default Page;
|
||||
|
||||
@@ -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