From eebe3c164a781703173b4a5c4954c5dadfc10a13 Mon Sep 17 00:00:00 2001 From: Neeraj138 Date: Fri, 24 Feb 2023 23:37:10 +0530 Subject: [PATCH] Fix: Unable to login after deleting all projects --- frontend/src/pages/dashboard/[id].tsx | 3 +-- frontend/src/pages/login.tsx | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/src/pages/dashboard/[id].tsx b/frontend/src/pages/dashboard/[id].tsx index 1ac570f71..6c4483d49 100644 --- a/frontend/src/pages/dashboard/[id].tsx +++ b/frontend/src/pages/dashboard/[id].tsx @@ -219,8 +219,7 @@ export default function Dashboard() { (async () => { if (router.isReady && workspaceId === 'undefined') { router.push('/noprojects'); - } - try { + } else try { const { push, query } = router const tempNumSnapshots = await getProjectSercetSnapshotsCount({ workspaceId diff --git a/frontend/src/pages/login.tsx b/frontend/src/pages/login.tsx index ec0dbaebb..64f1caca5 100644 --- a/frontend/src/pages/login.tsx +++ b/frontend/src/pages/login.tsx @@ -33,7 +33,7 @@ export default function Login() { let userWorkspace; try { const userWorkspaces = await getWorkspaces(); - userWorkspace = userWorkspaces[0]._id; + userWorkspace = userWorkspaces[0] && userWorkspaces[0]._id; router.push(`/dashboard/${userWorkspace}`); } catch (error) { console.log('Error - Not logged in yet');