mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-31 15:10:11 +00:00
完善获取文章列表
This commit is contained in:
@@ -13,7 +13,11 @@ export async function getPostBlocks(id, from, slice) {
|
||||
|
||||
console.warn('[请求API]:', `from:${from}`, `id:${id}`)
|
||||
pageBlock = await getPageWithRetry(id, from)
|
||||
console.warn('[请求完成]: 结果', `${pageBlock ? '成功' : '失败'}`, `from:${from}`, `id:${id}`)
|
||||
if (pageBlock) {
|
||||
console.info('[请求成功]:', `from:${from}`, `id:${id}`)
|
||||
} else {
|
||||
console.error('[请求失败]:', `from:${from}`, `id:${id}`)
|
||||
}
|
||||
|
||||
if (pageBlock) {
|
||||
await setDataToCache(cacheKey, pageBlock)
|
||||
@@ -29,7 +33,7 @@ export async function getPostBlocks(id, from, slice) {
|
||||
*/
|
||||
async function getPageWithRetry(id, from, retryAttempts = 3) {
|
||||
if (retryAttempts && retryAttempts > 0) {
|
||||
console.log('[发起请求]', `from:${from}`, `id:${id}`, `剩余重试次数:${retryAttempts}`)
|
||||
console.log('[发起请求]', `from:${from}`, `id:${id}`, retryAttempts < 3 ? `剩余重试次数:${retryAttempts}` : '')
|
||||
try {
|
||||
const authToken = BLOG.NOTION_ACCESS_TOKEN || null
|
||||
const api = new NotionAPI({ authToken })
|
||||
|
||||
Reference in New Issue
Block a user