mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-20 23:16:49 +00:00
feat(使用全局变量的 notionAPI): 避免多次创建NotionAPI,有效利用内置的concurrency并发请求限制
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
import { NotionAPI } from 'notion-client'
|
||||
import { NotionAPI as NotionLibrary } from 'notion-client'
|
||||
import BLOG from '@/blog.config'
|
||||
|
||||
export default function getNotionAPI() {
|
||||
return new NotionAPI({
|
||||
const notionAPI = getNotionAPI()
|
||||
|
||||
function getNotionAPI() {
|
||||
return new NotionLibrary({
|
||||
activeUser: BLOG.NOTION_ACTIVE_USER || null,
|
||||
authToken: BLOG.NOTION_TOKEN_V2 || null,
|
||||
userTimeZone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
||||
})
|
||||
}
|
||||
|
||||
export default notionAPI
|
||||
|
||||
Reference in New Issue
Block a user