🐛 Fix 404 error on invite page (#898)

This commit is contained in:
Luke Vella 2023-10-09 16:50:39 +03:00 committed by GitHub
parent 3a57a9551d
commit e85045a562
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -184,7 +184,7 @@ export const getStaticPaths = async () => {
export const getStaticProps: GetStaticProps = async (ctx) => {
// We get these props to be able to render the og:image
const poll = await prisma.poll.findUniqueOrThrow({
const poll = await prisma.poll.findUnique({
where: {
id: ctx.params?.urlId as string,
},
@ -199,6 +199,10 @@ export const getStaticProps: GetStaticProps = async (ctx) => {
},
});
if (!poll) {
return { props: {}, notFound: 404 };
}
const res = await getStaticTranslations(ctx);
if ("props" in res) {