added new api route + fixed dropdown

This commit is contained in:
daniel31x13
2023-10-29 00:57:24 -04:00
parent 2856e23a4a
commit 16024f40be
12 changed files with 348 additions and 203 deletions
+19 -3
View File
@@ -14,13 +14,29 @@ export default async function archive(
},
});
// const checkExistingLink = await prisma.link.findFirst({
// where: {
// id: linkId,
// OR: [
// {
// screenshotPath: "pending",
// },
// {
// pdfPath: "pending",
// },
// ],
// },
// });
// if (checkExistingLink) return "A request has already been made.";
const link = await prisma.link.update({
where: {
id: linkId,
},
data: {
screenshotPath: "pending",
pdfPath: "pending",
screenshotPath: user?.archiveAsScreenshot ? "pending" : null,
pdfPath: user?.archiveAsPDF ? "pending" : null,
},
});
@@ -88,8 +104,8 @@ export default async function archive(
await browser.close();
} catch (err) {
console.log(err);
await browser.close();
return err;
}
}
}