From aaca3ac229563c779b606cd8afbe1d9a83b2365e Mon Sep 17 00:00:00 2001 From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com> Date: Wed, 6 Mar 2024 03:19:58 +0100 Subject: [PATCH] Fix: Change org ID to org slug --- frontend/src/layouts/AppLayout/AppLayout.tsx | 2 +- frontend/src/pages/org/[id]/overview/index.tsx | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/frontend/src/layouts/AppLayout/AppLayout.tsx b/frontend/src/layouts/AppLayout/AppLayout.tsx index 7b0eeddbf..c09fd000f 100644 --- a/frontend/src/layouts/AppLayout/AppLayout.tsx +++ b/frontend/src/layouts/AppLayout/AppLayout.tsx @@ -226,7 +226,7 @@ export const AppLayout = ({ children }: LayoutProps) => { project: { id: newProjectId } } } = await createWs.mutateAsync({ - organizationId: currentOrg.id, + organizationSlug: currentOrg.slug, projectName: name }); diff --git a/frontend/src/pages/org/[id]/overview/index.tsx b/frontend/src/pages/org/[id]/overview/index.tsx index 601e7e55d..b37c8ab9e 100644 --- a/frontend/src/pages/org/[id]/overview/index.tsx +++ b/frontend/src/pages/org/[id]/overview/index.tsx @@ -44,6 +44,7 @@ import { import { OrgPermissionActions, OrgPermissionSubjects, + useOrganization, useSubscription, useUser, useWorkspace @@ -468,8 +469,9 @@ const OrganizationPage = withPermission( const router = useRouter(); const { workspaces, isLoading: isWorkspaceLoading } = useWorkspace(); - const currentOrg = String(router.query.id); - const orgWorkspaces = workspaces?.filter((workspace) => workspace.orgId === currentOrg) || []; + const { currentOrg } = useOrganization(); + const routerOrgId = String(router.query.id); + const orgWorkspaces = workspaces?.filter((workspace) => workspace.orgId === routerOrgId) || []; const { createNotification } = useNotificationContext(); const addUsersToProject = useAddUserToWsNonE2EE(); @@ -505,12 +507,12 @@ const OrganizationPage = withPermission( project: { id: newProjectId } } } = await createWs.mutateAsync({ - organizationId: currentOrg, + organizationSlug: currentOrg.slug, projectName: name }); if (addMembers) { - const orgUsers = await fetchOrgUsers(currentOrg); + const orgUsers = await fetchOrgUsers(currentOrg.id); await addUsersToProject.mutateAsync({ usernames: orgUsers @@ -540,7 +542,7 @@ const OrganizationPage = withPermission( useEffect(() => { onboardingCheck({ - orgId: currentOrg, + orgId: routerOrgId, setHasUserClickedIntro, setHasUserClickedSlack, setHasUserPushedSecrets,