Skip to content

Commit

Permalink
added logging to revalidation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ibnjunaid committed Jan 6, 2023
1 parent b3c1d68 commit fa70d3d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pages/api/revalidate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ export default async function handler(
) {
// Check for secret to confirm this is a valid request
if (req.body.secret !== process.env.TOKEN) {
console.log(req.body);
return res.status(401).json({ message: 'Invalid token' });
}

try {
res.revalidate(`/${req.body.path}`);
await res.revalidate(`/${req.body.path}`);
return res.json({ revalidated: true });
} catch (err) {
return res.status(500).json({
Expand Down

0 comments on commit fa70d3d

Please sign in to comment.