mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +10:00
documents detail page 404 handling
This commit is contained in:
@ -131,6 +131,12 @@ export async function getServerSideProps(context: any) {
|
|||||||
// todo optimize querys
|
// todo optimize querys
|
||||||
// todo no intersection groups
|
// todo no intersection groups
|
||||||
|
|
||||||
|
if (!document) {
|
||||||
|
return {
|
||||||
|
notFound: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
document: document,
|
document: document,
|
||||||
|
|||||||
@ -12,7 +12,7 @@ export const getDocument = async (
|
|||||||
if (!documentId) Promise.reject("No documentId");
|
if (!documentId) Promise.reject("No documentId");
|
||||||
if (!req || !res) Promise.reject("No res or req");
|
if (!req || !res) Promise.reject("No res or req");
|
||||||
|
|
||||||
const document: PrismaDocument = await prisma.document.findFirstOrThrow({
|
const document: PrismaDocument = await prisma.document.findFirst({
|
||||||
where: {
|
where: {
|
||||||
id: documentId,
|
id: documentId,
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user