You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importReact,{useState,useEffect}from'react';importNotionPagefrom'./pages/NotionPage';constApp=()=>{const[notionData,setNotionData]=useState(null);useEffect(()=>{// Notion 페이지 정보를 가져오는 비동기 함수 또는 API 호출을 수행constfetchNotionData=async()=>{constNOTION_API_URL='https://api.notion.com/v1';constPAGE_ID=process.env.REACT_APP_PAGE_ID;constNOTION_TOKEN=process.env.REACT_APP_SECRET;try{constresponse=awaitfetch(`${NOTION_API_URL}/blocks/${PAGE_ID}`,{headers: {Authorization: `Bearer ${NOTION_TOKEN}`,'Notion-Version': '2021-08-16',},});if(!response.ok){thrownewError('Notion API 호출에 실패했습니다.');}constdata=awaitresponse.json();setNotionData(data);}catch(error){console.error('Error fetching Notion data:',error);}};fetchNotionData();},[]);return(<divclassName='App'>{notionData ? <NotionPagenotionData={notionData}/> : '로딩 중...'}</div>);};exportdefaultApp;
Is there something wrong with my code?
I only use React.
Could it be because of notion’s CORS? Is there a way?
The text was updated successfully, but these errors were encountered:
Is there something wrong with my code?
I only use React.
Could it be because of notion’s CORS? Is there a way?
The text was updated successfully, but these errors were encountered: