我想使用 Notion 作为 SPA 的内容网关。我可以使用 fetch 中的 Notion API 吗?我正在尝试使用 fetch 来获取数据,但由于 CORS 而无法正常工作。
let notion = fetch(import.meta.env.VITE_NOTION_API_URL+'/databases/'+import.meta.env.VITE_NOTION_APP_DATABASE+'/query', {
method: 'POST',
mode: 'cors',
credentials: 'omit',
headers: {
'Content-Type': 'application/json',
"Authorization": `Bearer ${import.meta.env.VITE_NOTION_API_SECRET}`,
"Notion-Version": `${import.meta.env.VITE_NOTION_API_VERSION}`,
}
})
Run Code Online (Sandbox Code Playgroud)
这可能吗?
notion-api ×1