fix: cleanup after rebase

This commit is contained in:
Christel Westerberg
2024-02-12 14:04:53 +01:00
parent f7abe2c482
commit 2967f13921
5 changed files with 9 additions and 67 deletions
-30
View File
@@ -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
}
}
}
}
}
}
}
+5 -9
View File
@@ -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");