feat: update document editor routes to include search space context

- Modified API endpoints to include search space ID in the URL for fetching and saving documents.
- Added permission checks for reading and updating documents based on search space.
This commit is contained in:
DESKTOP-RTLN3BA\$punk 2025-11-30 14:27:27 -08:00
parent eefecfa4b9
commit d0c7be7eca
2 changed files with 40 additions and 12 deletions

View file

@ -45,7 +45,7 @@ export default function EditorPage() {
try {
const response = await fetch(
`${process.env.NEXT_PUBLIC_FASTAPI_BACKEND_URL}/api/v1/documents/${documentId}/editor-content`,
`${process.env.NEXT_PUBLIC_FASTAPI_BACKEND_URL}/api/v1/search-spaces/${params.search_space_id}/documents/${documentId}/editor-content`,
{
headers: {
Authorization: `Bearer ${token}`,
@ -114,7 +114,7 @@ export default function EditorPage() {
try {
// Save blocknote_document and trigger reindexing in background
const response = await fetch(
`${process.env.NEXT_PUBLIC_FASTAPI_BACKEND_URL}/api/v1/documents/${documentId}/save`,
`${process.env.NEXT_PUBLIC_FASTAPI_BACKEND_URL}/api/v1/search-spaces/${params.search_space_id}/documents/${documentId}/save`,
{
method: "POST",
headers: {