Skip to content

Commit

Permalink
revalidate first
Browse files Browse the repository at this point in the history
  • Loading branch information
pmi committed Sep 18, 2023
1 parent 3e10504 commit 3996814
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pages/api/revalidate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
}

try {
// Return 200 immediately and do revalidate in background
res.status(200).json({message: 'Revalidation started'});
if (!path) {
console.info('Started revalidating everything...');
const projectId = req.headers[PROJECT_ID_HEADER] as string | undefined;
Expand All @@ -39,6 +37,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
await revalidatePath(res, path);
console.info(`Revalidated [${path}]`);
}
// Return 200 after everything's revalidated
res.status(200).json({message: 'Revalidation started'});
} catch (err) {
console.error(`Revalidation [${path ?? 'everything'}] error: ` + err);
}
Expand Down

1 comment on commit 3996814

@vercel
Copy link

@vercel vercel bot commented on 3996814 Sep 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nextjs-enonic-demo – ./

nextjs-enonic-demo-git-master-pmi1k.vercel.app
nextjs-enonic-demo-pmi1k.vercel.app
nextjs-enonic-demo.vercel.app

Please sign in to comment.