summaryrefslogtreecommitdiff
path: root/frontend/src
diff options
context:
space:
mode:
authorblackhao <13851610112@163.com>2025-12-10 22:23:37 -0600
committerblackhao <13851610112@163.com>2025-12-10 22:23:37 -0600
commit180df64e94f00d05db9453ac20322455c96288e6 (patch)
tree6948ae14200f07a4cba98a9477a21a74bddf77bf /frontend/src
parent0c76ea3db76c9908e770b56fb94bf0a92a0d116f (diff)
fix: use getCurrentUser() for all project/file API calls
Diffstat (limited to 'frontend/src')
-rw-r--r--frontend/src/store/flowStore.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/frontend/src/store/flowStore.ts b/frontend/src/store/flowStore.ts
index 3d4930b..a919498 100644
--- a/frontend/src/store/flowStore.ts
+++ b/frontend/src/store/flowStore.ts
@@ -1523,7 +1523,7 @@ const useFlowStore = create<FlowState>((set, get) => {
await jsonFetch(`${API_BASE}/api/projects/create_folder`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ user: DEFAULT_USER, path }),
+ body: JSON.stringify({ user: getCurrentUser(), path }),
});
await get().refreshProjectTree();
},
@@ -1535,7 +1535,7 @@ const useFlowStore = create<FlowState>((set, get) => {
await jsonFetch(`${API_BASE}/api/projects/rename`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ user: DEFAULT_USER, path, new_name: newName, new_path: newPath }),
+ body: JSON.stringify({ user: getCurrentUser(), path, new_name: newName, new_path: newPath }),
});
await get().refreshProjectTree();
},
@@ -1544,7 +1544,7 @@ const useFlowStore = create<FlowState>((set, get) => {
await jsonFetch(`${API_BASE}/api/projects/delete`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ user: DEFAULT_USER, path, is_folder: isFolder }),
+ body: JSON.stringify({ user: getCurrentUser(), path, is_folder: isFolder }),
});
await get().refreshProjectTree();
},
@@ -1584,7 +1584,7 @@ const useFlowStore = create<FlowState>((set, get) => {
},
saveArchivedNodes: async () => {
- const payload = { user: DEFAULT_USER, archived: get().archivedNodes };
+ const payload = { user: getCurrentUser(), archived: get().archivedNodes };
await jsonFetch(`${API_BASE}/api/projects/archived`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@@ -1644,8 +1644,8 @@ const useFlowStore = create<FlowState>((set, get) => {
addFileScope: async (fileId: string, scope: string) => {
const res = await fetch(`${API_BASE}/api/files/add_scope`, {
method: 'POST',
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ user: DEFAULT_USER, file_id: fileId, scope }),
+ headers: { 'Content-Type': 'application/json', ...getAuthHeaders() },
+ body: JSON.stringify({ user: getCurrentUser(), file_id: fileId, scope }),
});
if (!res.ok) {
throw new Error(await res.text());
@@ -1656,8 +1656,8 @@ const useFlowStore = create<FlowState>((set, get) => {
removeFileScope: async (fileId: string, scope: string) => {
const res = await fetch(`${API_BASE}/api/files/remove_scope`, {
method: 'POST',
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ user: DEFAULT_USER, file_id: fileId, scope }),
+ headers: { 'Content-Type': 'application/json', ...getAuthHeaders() },
+ body: JSON.stringify({ user: getCurrentUser(), file_id: fileId, scope }),
});
if (!res.ok) {
throw new Error(await res.text());