diff --git a/src/app/helpers/page-data-utils.js b/src/app/helpers/page-data-utils.js index 488230340..bb659acf9 100644 --- a/src/app/helpers/page-data-utils.js +++ b/src/app/helpers/page-data-utils.js @@ -27,6 +27,10 @@ export function transformData(data) { return data; } +const draftParams = new window.URLSearchParams(window.location.search).has('preview') + ? `&draft=${Date.now()}` + : ''; + export async function getUrlFor(initialSlug) { let apiUrl = urlFromSlug(initialSlug); @@ -46,7 +50,7 @@ export async function getUrlFor(initialSlug) { const qsChar = ((/\?/).test(apiUrl)) ? '&' : '?'; - return `${apiUrl}${qsChar}format=json`; + return `${apiUrl}${qsChar}format=json${draftParams}`; } function camelCase(underscored) { diff --git a/src/index.html b/src/index.html index 852273f36..c3bc5114c 100644 --- a/src/index.html +++ b/src/index.html @@ -24,7 +24,6 @@ -