-
- You are viewing the latest changes in Preview Mode.
-
-
-
-
-
- )
- } else if(isDevelopmentMode) {
- return (
-
-
- You are viewing the latest changes in Development Mode.
-
-
- )
- } else {
- return null
- }
-}
-
-const exitPreview = () => {
- const exit = confirm("Would you like to exit Preview Mode?");
- if (exit === true) {
- window.location = `/api/exitPreview?slug=${window.location.pathname}`;
- }
-}
-
-const getPreviewLink = () => {
- const xhr = new XMLHttpRequest();
- xhr.onload = function () {
-
- // Process our return data
- if (xhr.status >= 200 && xhr.status < 300) {
- // What do when the request is successful
-
- const previewKey = xhr.responseText;
- const previewLink = `${window.location.pathname}?agilitypreviewkey=${escape(previewKey)}`;
-
- prompt("To share this page in preview mode with others, copy the link below:", previewLink);
-
- } else {
- // What do when the request fails
- alert('Could not generate Preview Link. This indicates a problem with the API route that generates a Preview Link.')
- }
- };
-
- // Create and send a GET request
- xhr.open('GET', '/api/generatePreviewKey');
- xhr.send();
-}
-
-export default PreviewBar;
\ No newline at end of file