We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3173af9 commit c904901Copy full SHA for c904901
src/routes/page.ts
@@ -8,13 +8,24 @@ export async function pageRoute(req: HandlerRequest) {
8
const pageId = parsePageId(req.params.pageId);
9
const page = await fetchPageById(pageId!, req.notionToken);
10
11
+ if (!pageId || !page.recordMap)
12
+ console.error(`Page not found at [ID:${req.params.pageId}]`)
13
+ return createResponse(
14
+ JSON.stringify({ error: "No page found on Notion at: " + pageId }),
15
+ {},
16
+ 401
17
+ );
18
+
19
20
const baseBlocks = page.recordMap.block;
21
22
let allBlocks: { [id: string]: BlockType & { collection?: any } } = {
23
...baseBlocks,
24
};
25
let allBlockKeys;
26
27
28
29
while (true) {
30
allBlockKeys = Object.keys(allBlocks);
31
0 commit comments