@udus/notion-renderer
Version:

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