-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
156 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export const envIdCookieName = "currentEnvId"; | ||
|
||
export const previewApiKeyCookieName = "currentPreviewApiKey"; | ||
|
||
export const ignoreMissingApiKeyCookieName = "ignoreMissingApiKey"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
import { NextApiHandler } from "next"; | ||
|
||
import { ignoreMissingApiKeyCookieName } from "../../lib/constants/cookies"; | ||
|
||
const handler: NextApiHandler = (req, res) => { | ||
console.log("Exiting preview"); | ||
// Exit the current user from "Preview Mode". This function accepts no args. | ||
res.clearPreviewData(); | ||
|
||
// Redirect the user back to the index page. | ||
// Might be implemented return URL by the query string. | ||
res.redirect("/"); | ||
} | ||
|
||
export default handler; | ||
// Exit the current user from "Preview Mode". This function accepts no args. | ||
res.clearPreviewData(); | ||
|
||
res.setHeader("Set-Cookie", `${ignoreMissingApiKeyCookieName}=; Path=/; SameSite=None; Secure; Max-Age=-1`); | ||
|
||
// Redirect the user back to the index page. | ||
// Might be implemented return URL by the query string. | ||
res.redirect(typeof req.query.callback === "string" ? req.query.callback : "/"); | ||
} | ||
|
||
export default handler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.