How to combine API request with router.refresh()
Unanswered
Drokoz posted this in #help-forum
DrokozOP
I need help implementing a functionality where:
1. I receive a POST request via an API endpoint that revalidates a specific cache tag.
2. After the revalidation, I want the page to automatically refresh to display the latest changes.
The process should work as follows:
• The POST request triggers the revalidation of a tag using Next.js’s revalidateTag or a similar mechanism.
• Once the revalidation is complete, the page automatically refreshes to show updated content.
Or maybe is a way to trigger an event or somerthing.
How can I best implement this using Next.js 14? Any examples or suggestions are greatly appreciated!
1. I receive a POST request via an API endpoint that revalidates a specific cache tag.
2. After the revalidation, I want the page to automatically refresh to display the latest changes.
The process should work as follows:
• The POST request triggers the revalidation of a tag using Next.js’s revalidateTag or a similar mechanism.
• Once the revalidation is complete, the page automatically refreshes to show updated content.
Or maybe is a way to trigger an event or somerthing.
How can I best implement this using Next.js 14? Any examples or suggestions are greatly appreciated!