mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-19 21:18:25 +02:00
Ensure tasks display correctly for selected stores by admins
Fixes an issue where admin users had to refresh the page to see tasks filtered by their selected store. This change ensures the store selection is properly initialized and validated before fetching tasks, preventing stale data and improving the user experience. The backend task fetching logic is also updated to correctly handle store filtering. Replit-Commit-Author: Agent Replit-Commit-Session-Id: e437ffed-c31b-44eb-9fd5-b6f9faa8e7ce Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/e437ffed-c31b-44eb-9fd5-b6f9faa8e7ce/OvGzl7P
This commit is contained in:
1 parent
9d9344f52e
commit
5688450117
3 files changed
+47
-8
No files matched your search
+10
-2
@@ -1265,11 +1265,19 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
userRole: user.role,
|
||||
userId: user.id,
|
||||
requestedStoreId: storeId,
|
||||
userGroups: user.role !== 'admin' ? user.userGroups.map(ug => ug.groupId) : 'all'
|
||||
userGroups: user.role !== 'admin' ? user.userGroups.map(ug => ug.groupId) : 'all',
|
||||
timestamp: new Date().toISOString()
|
||||
});
|
||||
|
||||
const tasks = await storage.getTasks(groupIds);
|
||||
console.log('📋 Tasks returned:', tasks.length, 'items for user:', user.id);
|
||||
console.log('📋 Tasks returned:', {
|
||||
count: tasks.length,
|
||||
userId: user.id,
|
||||
userRole: user.role,
|
||||
requestedStoreId: storeId,
|
||||
groupIds,
|
||||
taskGroups: tasks.map(t => ({ id: t.id, title: t.title, groupId: t.groupId })).slice(0, 3)
|
||||
});
|
||||
res.json(tasks);
|
||||
} catch (error) {
|
||||
console.error("Error fetching tasks:", error);
|
||||
|
||||
Reference in new issue
Block a user