From f1c47faded17207ba966465a7665f2b12aff5e6c Mon Sep 17 00:00:00 2001 From: bigint <69431456+bigint@users.noreply.github.com> Date: Sat, 24 Feb 2024 13:11:19 +0530 Subject: [PATCH] chore: update notion --- apps/api/src/lib/notion/pushToNotionDatabase.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/api/src/lib/notion/pushToNotionDatabase.ts b/apps/api/src/lib/notion/pushToNotionDatabase.ts index 9d48706bd135..cfcce43f3e46 100644 --- a/apps/api/src/lib/notion/pushToNotionDatabase.ts +++ b/apps/api/src/lib/notion/pushToNotionDatabase.ts @@ -1,13 +1,16 @@ import createNotionClient from './createNotionClient'; +const notion = createNotionClient(); + const pushToNotionDatabase = async (database_id: string, properties: any) => { - const notion = createNotionClient(); - const newPage = await notion.pages.create({ - parent: { database_id }, - properties - }); + try { + const newPage = await notion.pages.create({ + parent: { database_id }, + properties + }); - return newPage; + return newPage; + } catch {} }; export default pushToNotionDatabase;