From e7c75b544d45319cac7ef39dfb2eddd2d792534e Mon Sep 17 00:00:00 2001 From: Vladyslav Matsiiako Date: Tue, 10 Jan 2023 08:35:14 -0800 Subject: [PATCH] Fixed the discrepancies between projectIds in url and local storage --- frontend/components/basic/Layout.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/frontend/components/basic/Layout.tsx b/frontend/components/basic/Layout.tsx index 48399cdce..d539fce3f 100644 --- a/frontend/components/basic/Layout.tsx +++ b/frontend/components/basic/Layout.tsx @@ -211,9 +211,11 @@ export default function Layout({ children }: LayoutProps) { const intendedWorkspaceId = router.asPath .split("/") [router.asPath.split("/").length - 1].split("?")[0]; + + localStorage.setItem("projectData.id", intendedWorkspaceId); // If a user is not a member of a workspace they are trying to access, just push them to one of theirs if ( - intendedWorkspaceId != "heroku" && + !["heroku", "vercel", "github", "netlify"].includes(intendedWorkspaceId) && !userWorkspaces .map((workspace: { _id: string }) => workspace._id) .includes(intendedWorkspaceId) @@ -259,14 +261,14 @@ export default function Layout({ children }: LayoutProps) { .split("/") [router.asPath.split("/").length - 1].split("?")[0] ) { - router.push( - "/dashboard/" + - workspaceMapping[workspaceSelected as any] - ); localStorage.setItem( "projectData.id", `${workspaceMapping[workspaceSelected as any]}` ); + router.push( + "/dashboard/" + + workspaceMapping[workspaceSelected as any] + ); } } catch (error) { console.log(error);