frame-work lib/db

This commit is contained in:
tangly1024
2024-03-10 14:07:06 +08:00
parent 11d9eca881
commit 1fb9ba4abf
5 changed files with 8 additions and 10 deletions

View File

@@ -1,7 +1,6 @@
import BLOG from '@/blog.config'
import { getGlobalData, getPostBlocks } from '@/lib/db/getSiteData'
import { getGlobalData, getPostBlocks, getPost } from '@/lib/db/getSiteData'
import { idToUuid } from 'notion-utils'
import { getNotion } from '@/lib/notion/getNotion'
import Slug, { getRecommendPost } from '..'
import { uploadDataToAlgolia } from '@/lib/plugins/algolia'
import { checkContainHttp } from '@/lib/utils'
@@ -61,7 +60,7 @@ export async function getStaticProps({ params: { prefix, slug, suffix } }) {
if (!props?.post) {
const pageId = fullSlug.slice(-1)[0]
if (pageId.length >= 32) {
const post = await getNotion(pageId)
const post = await getPost(pageId)
props.post = post
}
}

View File

@@ -1,7 +1,6 @@
import BLOG from '@/blog.config'
import { getGlobalData, getPostBlocks } from '@/lib/db/getSiteData'
import { getGlobalData, getPostBlocks, getPost } from '@/lib/db/getSiteData'
import { idToUuid } from 'notion-utils'
import { getNotion } from '@/lib/notion/getNotion'
import Slug, { getRecommendPost } from '..'
import { uploadDataToAlgolia } from '@/lib/plugins/algolia'
import { checkContainHttp } from '@/lib/utils'
@@ -52,7 +51,7 @@ export async function getStaticProps({ params: { prefix, slug } }) {
if (!props?.post) {
const pageId = slug.slice(-1)[0]
if (pageId.length >= 32) {
const post = await getNotion(pageId)
const post = await getPost(pageId)
props.post = post
}
}

View File

@@ -1,9 +1,8 @@
import BLOG from '@/blog.config'
import { getGlobalData, getPostBlocks } from '@/lib/db/getSiteData'
import { getGlobalData, getPostBlocks, getPost } from '@/lib/db/getSiteData'
import { useEffect, useState } from 'react'
import { idToUuid } from 'notion-utils'
import { useRouter } from 'next/router'
import { getNotion } from '@/lib/notion/getNotion'
import { getPageTableOfContents } from '@/lib/notion/getPageTableOfContents'
import { getLayoutByTheme } from '@/themes/theme'
import md5 from 'js-md5'
@@ -92,7 +91,7 @@ export async function getStaticProps({ params: { prefix } }) {
if (!props?.post) {
const pageId = prefix
if (pageId.length >= 32) {
const post = await getNotion(pageId)
const post = await getPost(pageId)
props.post = post
}
}