From b9a2081a76e669688d5884f20482b37cc8acca22 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Mon, 13 Oct 2025 08:56:27 +0000
Subject: (최겸, 임수민) 구매 입찰, 견적(그룹코드, tbe에러) 수정, data-room
 수정
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 components/project/ProjectList.tsx | 37 ++++++++++++++++++++++++-------------
 1 file changed, 24 insertions(+), 13 deletions(-)

(limited to 'components/project/ProjectList.tsx')

diff --git a/components/project/ProjectList.tsx b/components/project/ProjectList.tsx
index 9dec7e77..e267b21c 100644
--- a/components/project/ProjectList.tsx
+++ b/components/project/ProjectList.tsx
@@ -98,20 +98,31 @@ export function ProjectList() {
     fetchProjects();
   }, []);
 
-  const fetchProjects = async () => {
-    try {
-      const response = await fetch('/api/projects');
-      const data = await response.json();
-      setProjects(data);
-    } catch (error) {
-      toast({
-        title: 'Error',
-        description: 'Unable to load project list.',
-        variant: 'destructive',
-      });
+// components/project/ProjectList.tsx 의 fetchProjects 함수 수정
+
+const fetchProjects = async () => {
+  try {
+    const response = await fetch('/api/projects');
+    const data = await response.json();
+    setProjects(data);
+    
+    // 멤버인 프로젝트가 정확히 1개일 때 자동 리다이렉트
+    const memberProjects = data.member || [];
+    const ownedProjects = data.owned || [];
+    const totalProjects = [...memberProjects, ...ownedProjects];
+    
+    if (totalProjects.length === 1) {
+      const singleProject = totalProjects[0];
+      router.push(`/evcp/data-room/${singleProject.id}/files`);
     }
-  };
-
+  } catch (error) {
+    toast({
+      title: 'Error',
+      description: 'Unable to load project list.',
+      variant: 'destructive',
+    });
+  }
+};
   const onSubmit = async (data: ProjectFormData) => {
     setIsSubmitting(true);
     try {
-- 
cgit v1.2.3

