UNPKG

@udus/notion-renderer

Version:
25 lines (24 loc) 808 B
import { convertResponseToRichText } from "../../richText/richText.js"; import { fetchBlockList } from "../fetchBlockList.js"; export const convertToggleResponseToBlock = async (block, client) => { if (block.has_children) { const { ok, data } = await fetchBlockList(client, { block_id: block.id }); if (ok) { return { ...block, toggle: { ...block.toggle, rich_text: await convertResponseToRichText(block.toggle.rich_text, client), children: data, }, }; } } return { ...block, toggle: { ...block.toggle, rich_text: await convertResponseToRichText(block.toggle.rich_text, client), }, }; };