fix: cleanup after rebase
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
#import "../PageLinks.graphql"
|
||||
|
||||
fragment HeroBlock on CurrentBlocksPageBlocksHero {
|
||||
hero {
|
||||
imagesConnection {
|
||||
totalCount
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
url
|
||||
}
|
||||
}
|
||||
}
|
||||
ingress {
|
||||
json
|
||||
embedded_itemsConnection {
|
||||
edges {
|
||||
node {
|
||||
...CurrentBlocksPageLink
|
||||
...TempPageLink
|
||||
... on SysAsset {
|
||||
title
|
||||
url
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,30 +12,26 @@ export async function previewRequest<T>(
|
||||
variables?: {}
|
||||
): Promise<Data<T>> {
|
||||
try {
|
||||
const hash = ContentstackLivePreview.hash;
|
||||
const hash = ContentstackLivePreview.hash
|
||||
|
||||
if (!hash) {
|
||||
throw new Error("No hash received");
|
||||
}
|
||||
|
||||
if (!env.CMS_PREVIEW_URL || !env.CMS_PREVIEW_TOKEN) {
|
||||
throw new Error("No preview URL or token");
|
||||
throw new Error("No hash received")
|
||||
}
|
||||
|
||||
const headers = new Headers({
|
||||
access_token: env.CMS_ACCESS_TOKEN,
|
||||
preview_token: env.CMS_PREVIEW_TOKEN,
|
||||
live_preview: hash,
|
||||
});
|
||||
})
|
||||
|
||||
const response = await graphqlRequest<T>({
|
||||
document: query,
|
||||
requestHeaders: headers,
|
||||
url: env.CMS_PREVIEW_URL,
|
||||
variables,
|
||||
});
|
||||
})
|
||||
|
||||
return { data: response };
|
||||
return { data: response }
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw new Error("Something went wrong");
|
||||
|
||||
Reference in New Issue
Block a user