Skip to content

Commit

Permalink
fix: 100개 이상의 포스트를 가져오기
Browse files Browse the repository at this point in the history
  • Loading branch information
muyaaho authored Nov 17, 2024
1 parent 515c7cf commit cffccbf
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/apis/notion-client/getPosts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,21 @@ export const getPosts = async () => {
} else {
// Construct Data
const pageIds = getAllPageIds(response)
const tempBlock = await (await api.getBlocks(pageIds)).recordMap.block

const data = []
for (let i = 0; i < pageIds.length; i++) {
const id = pageIds[i]
const properties = (await getPageProperties(id, block, schema)) || null
const properties =
(await getPageProperties(id, tempBlock, schema)) || null
if (!tempBlock[id]) continue

// Add fullwidth, createdtime to properties
properties.createdTime = new Date(
block[id].value?.created_time
tempBlock[id].value?.created_time
).toString()
properties.fullWidth =
(block[id].value?.format as any)?.page_full_width ?? false
(tempBlock[id].value?.format as any)?.page_full_width ?? false

data.push(properties)
}
Expand Down

0 comments on commit cffccbf

Please sign in to comment.