mirror of
https://github.com/LaconicNetwork/laconic.com.git
synced 2026-05-05 09:44:07 +00:00
Signed-off-by: Traxus <shyidx@gmail.com>
This commit is contained in:
parent
92cd414663
commit
0fdc371202
@ -21,6 +21,21 @@ 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)
|
||||
@ -260,7 +275,7 @@ function getBlogJsonDirectoryPath() {
|
||||
function pluckBlogPostData(json: any) {
|
||||
//let plucked: BlogPostRecord = {}
|
||||
let plucked: any = {}
|
||||
|
||||
|
||||
if ('data' in json) {
|
||||
if ('blogPost' in json.data) {
|
||||
plucked = json.data.blogPost
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import tiny from 'tiny-json-http'
|
||||
|
||||
//===== \/ START NEXT_PUBLIC_DATOCMS_BYPASS \/ ====================================================
|
||||
|
||||
import { datocmsQueryIntercept } from 'lib/datocms-bypass'
|
||||
|
||||
//===== /\ FINISH NEXT_PUBLIC_DATOCMS_BYPASS /\ ====================================================
|
||||
|
||||
import tiny from 'tiny-json-http'
|
||||
|
||||
interface props {
|
||||
query: string
|
||||
variables?: string
|
||||
|
||||
@ -137,7 +137,7 @@ export const getStaticProps: GetStaticProps = async (
|
||||
const relatedPosts = allBlogPosts.data.filter((p) =>
|
||||
p.category.some((c) =>
|
||||
post?.category.some(
|
||||
(postCategory: any) => c.slug === postCategory.slug)
|
||||
(postCategory: any) => c.slug === postCategory.slug)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user