* add user pages to config.matcher in middleware * add app router user booking pages * remove HeadSeo from users-public-view component * remove pages router user booking pages * fix type check * fix embed * fix test * chore: remove BookerSEO from users-type-public-view * fix
38 lines
1.0 KiB
TypeScript
38 lines
1.0 KiB
TypeScript
import type { GetServerSidePropsContext } from "next";
|
|
|
|
import { getSlugOrRequestedSlug } from "@calcom/features/ee/organizations/lib/orgDomains";
|
|
import prisma from "@calcom/prisma";
|
|
|
|
import { getServerSideProps as GSSTeamPage } from "@lib/team/[slug]/getServerSideProps";
|
|
|
|
import { getServerSideProps as GSSUserPage } from "@server/lib/[user]/getServerSideProps";
|
|
|
|
export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
|
|
const team = await prisma.team.findFirst({
|
|
where: {
|
|
slug: ctx.query.user as string,
|
|
parentId: {
|
|
not: null,
|
|
},
|
|
parent: getSlugOrRequestedSlug(ctx.query.orgSlug as string),
|
|
},
|
|
select: {
|
|
id: true,
|
|
},
|
|
});
|
|
if (team) {
|
|
return GSSTeamPage({
|
|
...ctx,
|
|
query: { slug: ctx.query.user, orgRedirection: ctx.query.orgRedirection },
|
|
});
|
|
}
|
|
return GSSUserPage({
|
|
...ctx,
|
|
query: {
|
|
user: ctx.query.user,
|
|
redirect: ctx.query.redirect,
|
|
orgRedirection: ctx.query.orgRedirection,
|
|
},
|
|
});
|
|
};
|