Selaa lähdekoodia

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

jose-fully-ported 2 vuotta sitten
vanhempi
sitoutus
8e745c9362
1 muutettua tiedostoa jossa 7 lisäystä ja 0 poistoa
  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);