From ce21156a8f2436e08f80802e2a27531dade2d061 Mon Sep 17 00:00:00 2001 From: kibum99 Date: Thu, 21 Aug 2025 01:39:32 +0900 Subject: [PATCH] [Fix] No Endpoints for FetchBlocks --- src/api/notion.ts | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/api/notion.ts b/src/api/notion.ts index f3da329..293cdcd 100644 --- a/src/api/notion.ts +++ b/src/api/notion.ts @@ -5,6 +5,8 @@ import { CollectionData, NotionSearchParamsType, NotionSearchResultsType, + BlockType, + RecordMapType, } from "./types"; const NOTION_API = "https://www.notion.so/api/v3"; @@ -126,8 +128,8 @@ export const fetchBlocks = async ( blockList: string[], notionToken?: string ) => { - return await fetchNotionData({ - resource: "syncRecordValues", + const response = await fetchNotionData<{ results: BlockType[] }>({ + resource: "getRecordValues", body: { requests: blockList.map((id) => ({ id, @@ -137,6 +139,26 @@ export const fetchBlocks = async ( }, notionToken, }); + + const recordMap: RecordMapType = { + block: {}, + notion_user: {}, + collection: {}, + collection_view: {}, + }; + + if (response.results) { + response.results.forEach((block) => { + recordMap.block[block.value.id] = block; + }); + } + + return { + recordMap, + cursor: { + stack: [], + }, + } as LoadPageChunkData; }; export const fetchNotionSearch = async (