Revalidating a SSG path in a tRPC procedure

Hello guys, how could I revalidate a path in a tRPC procedure? I have a NextJS pages site that is mainly SSG with an admin panel. When a user creates a new blogpost for.example I want to revalidate that path (ISR) (https://nextjs.org/docs/pages/building-your-application/data-fetching/incremental-static-regeneration#using-on-demand-revalidation). How could I do that? I probably need the Response object from NextJS This is my procedure:
createBlogPost: protectedProcedure
.input(blogPostSchema)
.mutation(async ({ input }) => {
const blogpost = await db.blogPost.create({
data: {
title: input.title,
body: input.body,
post_date: input.post_date,
image_url: input.image_url,
},
});
return blogpost;
}),
}),
createBlogPost: protectedProcedure
.input(blogPostSchema)
.mutation(async ({ input }) => {
const blogpost = await db.blogPost.create({
data: {
title: input.title,
body: input.body,
post_date: input.post_date,
image_url: input.image_url,
},
});
return blogpost;
}),
}),
4 Replies
sommeeeR
sommeeeROP12mo ago
thank you!
sommeeeR
sommeeeROP12mo ago
im getting error on both tho:
No description
sommeeeR
sommeeeROP12mo ago
Type error: Property 'res' does not exist on type 'CreateContextOptions'. guess i try to edit the types
Want results from more Discord servers?
Add your server