fix: sidebar projectId from nested project object

This commit is contained in:
pray4skylark
2026-06-12 10:36:45 +09:00
parent 65c123fec9
commit 17cd28e5f6
+2 -2
View File
@@ -55,7 +55,7 @@ const Sidebar = ({ isCollapsed }: { isCollapsed?: boolean }) => {
if (!user) return;
employeeService.getActiveDispatches().then((res) => {
if (res.success && res.data) {
setActiveDispatches(res.data.map((d: any) => ({ projectName: d.projectName || 'Project', projectId: d.projectId })));
setActiveDispatches(res.data.map((d: any) => ({ projectName: d.project?.projectName || 'Project', projectId: d.project?.projectId })));
}
}).catch(() => {});
}, [user]);
@@ -343,7 +343,7 @@ const Sidebar = ({ isCollapsed }: { isCollapsed?: boolean }) => {
{projectsList.length > 0 ? projectsList.map((project) => (
<Link
key={project.name}
href={`/dispatch?projectId=${project.projectId}`}
href={`/dispatch${project.projectId ? `?projectId=${project.projectId}` : ''}`}
title={isCollapsed ? project.name : ''}
className={`flex items-center hover:bg-gray-50 rounded-xl text-xs font-bold text-text-muted transition-colors ${
isCollapsed ? 'justify-center py-2' : 'px-3 py-2'