mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 16:27:46 +00:00
Fixed the discrepancies between projectIds in url and local storage
This commit is contained in:
@@ -211,9 +211,11 @@ export default function Layout({ children }: LayoutProps) {
|
|||||||
const intendedWorkspaceId = router.asPath
|
const intendedWorkspaceId = router.asPath
|
||||||
.split("/")
|
.split("/")
|
||||||
[router.asPath.split("/").length - 1].split("?")[0];
|
[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 a user is not a member of a workspace they are trying to access, just push them to one of theirs
|
||||||
if (
|
if (
|
||||||
intendedWorkspaceId != "heroku" &&
|
!["heroku", "vercel", "github", "netlify"].includes(intendedWorkspaceId) &&
|
||||||
!userWorkspaces
|
!userWorkspaces
|
||||||
.map((workspace: { _id: string }) => workspace._id)
|
.map((workspace: { _id: string }) => workspace._id)
|
||||||
.includes(intendedWorkspaceId)
|
.includes(intendedWorkspaceId)
|
||||||
@@ -259,14 +261,14 @@ export default function Layout({ children }: LayoutProps) {
|
|||||||
.split("/")
|
.split("/")
|
||||||
[router.asPath.split("/").length - 1].split("?")[0]
|
[router.asPath.split("/").length - 1].split("?")[0]
|
||||||
) {
|
) {
|
||||||
router.push(
|
|
||||||
"/dashboard/" +
|
|
||||||
workspaceMapping[workspaceSelected as any]
|
|
||||||
);
|
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
"projectData.id",
|
"projectData.id",
|
||||||
`${workspaceMapping[workspaceSelected as any]}`
|
`${workspaceMapping[workspaceSelected as any]}`
|
||||||
);
|
);
|
||||||
|
router.push(
|
||||||
|
"/dashboard/" +
|
||||||
|
workspaceMapping[workspaceSelected as any]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|||||||
Reference in New Issue
Block a user