fix: build error in formbricks-com when STRAPI_API_KEY not set (#785)

This commit is contained in:
Shubham Palriwala
2023-09-07 19:51:24 +05:30
committed by GitHub
parent 0a1de196aa
commit c901ab13f5

View File

@@ -52,6 +52,9 @@ interface ArticleResponse {
}
export async function getStaticPaths() {
if (!process.env.STRAPI_API_KEY) {
return { paths: [], fallback: true };
}
const response = await fetch(
"https://strapi.formbricks.com/api/articles?populate[meta][populate]=*&filters[category][name][$eq]=learn",
{
@@ -74,6 +77,9 @@ export async function getStaticPaths() {
}
export async function getStaticProps({ params }) {
if (!process.env.STRAPI_API_KEY) {
return { props: { article: null } };
}
const res = await fetch(
`https://strapi.formbricks.com/api/articles?populate[meta][populate]=*&populate[faq][populate]=*&filters[slug][$eq]=${params.slug}`,
{