From 180df64e94f00d05db9453ac20322455c96288e6 Mon Sep 17 00:00:00 2001 From: blackhao <13851610112@163.com> Date: Wed, 10 Dec 2025 22:23:37 -0600 Subject: fix: use getCurrentUser() for all project/file API calls --- frontend/src/store/flowStore.ts | 16 ++++++++-------- 1 file 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((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((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((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((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((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((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()); -- cgit v1.2.3