2
0

🧰 Aggregate utils & set up results collection in viewer

This commit is contained in:
Baptiste Arnaud
2021-12-29 10:22:26 +01:00
parent 447172d0cb
commit f088f694b9
42 changed files with 404 additions and 141 deletions

View File

@ -11,7 +11,7 @@ export const getServerSideProps: GetServerSideProps = async (
const pathname = context.resolvedUrl.split('?')[0]
try {
if (!context.req.headers.host) return { props: {} }
typebot = await getTypebotFromPublicId(context.query.publicId.toString())
typebot = await getTypebotFromPublicId(context.query.publicId?.toString())
if (!typebot) return { props: {} }
return {
props: {
@ -32,8 +32,9 @@ export const getServerSideProps: GetServerSideProps = async (
}
const getTypebotFromPublicId = async (
publicId: string
publicId?: string
): Promise<PublicTypebot | undefined> => {
if (!publicId) return
const typebot = await prisma.publicTypebot.findUnique({
where: { publicId },
})