Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

Commit 17db4bf

Browse files
committed
Add exit preview api cb
1 parent 40b05ed commit 17db4bf

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pages/api/exit-preview.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* Exit preview mode and redirect to homepage.
3+
*
4+
* @param {object} req Instance of http.IncomingMessage.
5+
* @param {object} res Instance of http.ServerResponse.
6+
*/
7+
export default async function exit(req, res) {
8+
res.clearPreviewData()
9+
res.writeHead(307, {Location: '/'})
10+
res.end()
11+
}

0 commit comments

Comments
 (0)