소스 검색

POR-1714: properly redirect users to their first project if the project they attempt to route to is non-existent (#3648)

jose-fully-ported 3 년 전
부모
커밋
8e745c9362
1개의 변경된 파일7개의 추가작업 그리고 0개의 파일을 삭제
  1. 7 0
      dashboard/src/main/home/Home.tsx

+ 7 - 0
dashboard/src/main/home/Home.tsx

@@ -140,6 +140,13 @@ const Home: React.FC<Props> = (props) => {
             Number(localStorage.getItem("currentProject")) || projectList[0].id;
         }
 
+        const foundProjectListEntry = projectList.find(
+          (item: ProjectListType) => item.id === id
+        );
+        if (foundProjectListEntry === undefined) {
+          id = projectList[0].id
+        }
+
         const project = await api
           .getProject("<token>", {}, { id: id })
           .then((res) => res.data as ProjectType);