Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix (#641)

Marc Seitz015aa43533f6
diff --git a/components/NotionPage.tsx b/components/NotionPage.tsx
index e346e2a8..a77bdf16 100644
--- a/components/NotionPage.tsx
+++ b/components/NotionPage.tsx
@@ -120,7 +120,7 @@ export const NotionPage = ({
setLoading(true);
console.log("Fetching subPageId", pageId);
try {
- const response = await fetch(`/api/file/notion`, {
+ const response = await fetch("/api/file/notion", {
method: "POST",
body: JSON.stringify({ pageId }),
headers: {
@@ -158,32 +158,32 @@ export const NotionPage = ({
fetchSubPage(subPageId);
}, [subPageId, fetchSubPage]);
- useEffect(() => {
- const fetchSubPage = async () => {
- if (subPageId) {
- setLoading(true);
- console.log("subPageId", subPageId);
- const recordMap = await fetch(`/api/file/notion`, {
- method: "POST",
- body: JSON.stringify({ pageId: subPageId }),
- headers: {
- "Content-Type": "application/json",
- },
- });
- setRecordMapState(await recordMap.json());
- setLoading(false);
- } else {
- console.log("subPageId is", subPageId);
- setRecordMapState(recordMap);
- }
-
- const duration = Date.now() - startTimeRef.current;
- trackPageView(duration);
- startTimeRef.current = Date.now();
- };
+ // useEffect(() => {
+ // const fetchSubPage = async () => {
+ // if (subPageId) {
+ // setLoading(true);
+ // console.log("subPageId", subPageId);
+ // const recordMap = await fetch("/api/file/notion", {
+ // method: "POST",
+ // body: JSON.stringify({ pageId: subPageId }),
+ // headers: {
+ // "Content-Type": "application/json",
+ // },
+ // });
+ // setRecordMapState(await recordMap.json());
+ // setLoading(false);
+ // } else {
+ // console.log("subPageId is", subPageId);
+ // setRecordMapState(recordMap);
+ // }
+
+ // const duration = Date.now() - startTimeRef.current;
+ // trackPageView(duration);
+ // startTimeRef.current = Date.now();
+ // };
- fetchSubPage();
- }, [subPageId]);
+ // fetchSubPage();
+ // }, [subPageId]);
useEffect(() => {
const handleBeforeUnload = () => {
diff --git a/pages/api/file/notion/index.ts b/pages/api/file/notion/index.ts
index 95d9ba0a..04481dfe 100644
--- a/pages/api/file/notion/index.ts
+++ b/pages/api/file/notion/index.ts
@@ -8,6 +8,7 @@ export default async function handle(
) {
// We only allow POST requests
if (req.method !== "POST") {
+ console.log("Method Not Allowed because method is", req.method);
res.status(405).json({ message: "Method Not Allowed" });
return;
}