mirror of
https://github.com/LaconicNetwork/laconic.com.git
synced 2026-04-19 07:54:07 +00:00
Signed-off-by: Traxus <shyidx@gmail.com>
This commit is contained in:
parent
de68f5e210
commit
87a4222f25
@ -21,21 +21,6 @@ function datocmsDateToIng(date: string): number {
|
||||
return dateInt
|
||||
}
|
||||
|
||||
export function queriedPostsHasResults(queriedPosts: any) {
|
||||
if ('pages' in queriedPosts === true) {
|
||||
if (0 in queriedPosts.pages === true) {
|
||||
if ('pagination' in queriedPosts.pages[0]) {
|
||||
if ('total' in queriedPosts.pages[0].pagination) {
|
||||
if (queriedPosts.pages[0].pagination.total > 0) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
//-----graphql query interception
|
||||
export async function datocmsQueryIntercept(query: any) {
|
||||
const parent = pluckFirstParentFromQuery(query)
|
||||
|
||||
@ -130,7 +130,7 @@ export const getStaticProps: GetStaticProps = async (
|
||||
relatedBlogPostsFromSource = allBlogPosts.data.filter((p) =>
|
||||
p.category.some((c) =>
|
||||
post?.category.some(
|
||||
(postCategory: any) => c.slug === postCategory.slug)
|
||||
(postCategory: any) => c.slug === postCategory.slug)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@ -119,23 +119,22 @@ const BlogIndexPage = ({
|
||||
}
|
||||
)
|
||||
|
||||
function queriedPostsHasResults(queriedPosts: any) {
|
||||
if ('pages' in queriedPosts === true) {
|
||||
if (0 in queriedPosts.pages === true) {
|
||||
if ('pagination' in queriedPosts.pages[0]) {
|
||||
if ('total' in queriedPosts.pages[0].pagination) {
|
||||
if (queriedPosts.pages[0].pagination.total > 0) {
|
||||
return true
|
||||
}
|
||||
let queriedPostsHasResults = false
|
||||
|
||||
if ('pages' in queriedPosts === true) {
|
||||
if (0 in queriedPosts.pages === true) {
|
||||
if ('pagination' in queriedPosts.pages[0]) {
|
||||
if ('total' in queriedPosts.pages[0].pagination) {
|
||||
if (queriedPosts.pages[0].pagination.total > 0) {
|
||||
queriedPostsHasResults = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
//const hasResults = !!queriedPosts?.pages[0]?.data?.length
|
||||
const hasResults = queriedPostsHasResults(queriedPosts)
|
||||
const hasResults = queriedPostsHasResults
|
||||
|
||||
return (
|
||||
<PageLayout footerData={footerData} headerData={headerData}>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user