Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix: revalidate when archiving

Marc Seitz9eb2f90d2280
diff --git a/pages/api/links/[id]/archive.ts b/pages/api/links/[id]/archive.ts
index e2e2e835..2c7593b3 100644
--- a/pages/api/links/[id]/archive.ts
+++ b/pages/api/links/[id]/archive.ts
@@ -6,7 +6,7 @@ import { errorhandler } from "@/lib/errorHandler";
export default async function handle(
req: NextApiRequest,
- res: NextApiResponse
+ res: NextApiResponse,
) {
if (req.method === "PUT") {
// PUT /api/links/:id/archive
@@ -42,6 +42,10 @@ export default async function handle(
return res.status(404).json({ error: "Link not found" });
}
+ await fetch(
+ `${process.env.NEXTAUTH_URL}/api/revalidate?secret=${process.env.REVALIDATE_TOKEN}&linkId=${id}`,
+ );
+
return res.status(200).json(updatedLink);
} catch (error) {
errorhandler(error, res);