Skip to content

Commit

Permalink
fix revalidate tool
Browse files Browse the repository at this point in the history
  • Loading branch information
GraemeFulton committed Apr 30, 2024
1 parent 0894123 commit a786757
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pages/api/revalidate.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default async function handler(req, res) {

try {
const { entry } = req.body;
console.log(req.body)
// revalidate posts
if (entry.type=='article' && (entry.status === "publish" || entry.publishedAt)) {
console.log("revalidating published post :", entry.slug);
Expand All @@ -17,7 +18,7 @@ export default async function handler(req, res) {
return res.json({ revalidated: true });
}
//revalidate jobs
else if(entry.publishedAt){
else if(entry.type=='job' && entry.publishedAt){
console.log("revalidating job post :", entry.slug);
const url = `/jobs/${entry.id}`;
await res.revalidate(url);
Expand Down

0 comments on commit a786757

Please sign in to comment.