Advertisement
dobrado

Untitled

Sep 15th, 2020
906
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const client = Prismic.client(apiEndpoint);
  2. const Preview = ({ history, location }) => {
  3.   useEffect(() => {
  4.     const {token, documentId} = qs.parse(location.search.slice(1));
  5.     if (!token) {
  6.       return console.warn(`No token available, check your configuration`);
  7.     }
  8.     client.getPreviewResolver(token, documentId).resolve(linkResolver, '/').then(url => history.push(url));
  9.     });
  10.   return null;
  11. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement