From 38294856728dc75121b09ce69cad91a02f94f774 Mon Sep 17 00:00:00 2001 From: prathamesh0 <42446521+prathamesh0@users.noreply.github.com> Date: Tue, 23 Jan 2024 11:12:53 +0530 Subject: [PATCH] Handle if organizations is empty (#31) Co-authored-by: neeraj --- packages/frontend/src/layouts/ProjectSearch.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/frontend/src/layouts/ProjectSearch.tsx b/packages/frontend/src/layouts/ProjectSearch.tsx index a8d9a71e..481fb508 100644 --- a/packages/frontend/src/layouts/ProjectSearch.tsx +++ b/packages/frontend/src/layouts/ProjectSearch.tsx @@ -16,8 +16,8 @@ const ProjectSearch = () => { const res = await client.getOrganizations(); // Note: select first organization as organization switching not yet implemented - const projects = res.organizations[0].projects; - const orgName = res.organizations[0].name; + const projects = res.organizations[0]?.projects || []; + const orgName = res.organizations[0]?.name || ''; const updatedProjectsPromises = projects.map(async (project: any) => { const { deployments } = await client.getDeployments(String(project.id));