1234567891011121314151617181920212223242526272829 |
- import { NotionAPI } from "notion-client";
- import { NOTION_KEY, NOTION_USER_ID, NOTION_USER_TOKEN } from "../config";
- import { DatabaseType } from "../types";
-
- const { Client } = require("@notionhq/client");
-
- export const notion = new Client({ auth: NOTION_KEY });
- export const renderClient = new NotionAPI({
- authToken: NOTION_USER_TOKEN,
- activeUser: NOTION_USER_ID,
- });
-
- /**
- * Translates incoming GET parameters into a valid block ID.
- * @param type
- * @returns string
- */
- export function getDatabaseId(type: DatabaseType): string | undefined {
- switch (type) {
- case "laws":
- return "d02fa51eda254c9fa4b97e5f9beb1a86";
-
- case "advice":
- return "9515c0f02e454e968c44336bd1beb463";
-
- default:
- return undefined;
- }
- }
|