Handle if organizations is empty (#31)

Co-authored-by: neeraj <neeraj.rtly@gmail.com>
This commit is contained in:
prathamesh0 2024-01-23 11:12:53 +05:30 committed by Ashwin Phatak
parent d4b0659307
commit 3829485672

View File

@ -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));