Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const client = Prismic.client(apiEndpoint);
- const Preview = ({ history, location }) => {
- useEffect(() => {
- const {token, documentId} = qs.parse(location.search.slice(1));
- if (!token) {
- return console.warn(`No token available, check your configuration`);
- }
- client.getPreviewResolver(token, documentId).resolve(linkResolver, '/').then(url => history.push(url));
- });
- return null;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement