File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
site/src/pages/GroupsPage Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -5,11 +5,13 @@ import { useNavigate } from "react-router-dom";
5
5
import { createGroup } from "api/queries/groups" ;
6
6
import { pageTitle } from "utils/page" ;
7
7
import CreateGroupPageView from "./CreateGroupPageView" ;
8
+ import { useDashboard } from "modules/dashboard/useDashboard" ;
8
9
9
10
export const CreateGroupPage : FC = ( ) => {
10
11
const queryClient = useQueryClient ( ) ;
11
12
const navigate = useNavigate ( ) ;
12
13
const createGroupMutation = useMutation ( createGroup ( queryClient , "default" ) ) ;
14
+ const { experiments } = useDashboard ( ) ;
13
15
14
16
return (
15
17
< >
@@ -19,7 +21,13 @@ export const CreateGroupPage: FC = () => {
19
21
< CreateGroupPageView
20
22
onSubmit = { async ( data ) => {
21
23
const newGroup = await createGroupMutation . mutateAsync ( data ) ;
22
- navigate ( `/groups/${ newGroup . name } ` ) ;
24
+
25
+ let groupURL = `/groups/${ newGroup . name } ` ;
26
+ if ( experiments . includes ( "multi-organization" ) ) {
27
+ groupURL = `/organizations/${ newGroup . organization_id } /groups/${ newGroup . name } ` ;
28
+ }
29
+
30
+ navigate ( groupURL ) ;
23
31
} }
24
32
error = { createGroupMutation . error }
25
33
isLoading = { createGroupMutation . isLoading }
Original file line number Diff line number Diff line change @@ -60,7 +60,10 @@ export const GroupPage: FC = () => {
60
60
} ;
61
61
const queryClient = useQueryClient ( ) ;
62
62
const navigate = useNavigate ( ) ;
63
- const groupQuery = useQuery ( group ( organization , groupName ) ) ;
63
+ // TODO: Always use the correct organization. At present, the url to fetch a group
64
+ // is /groups/:groupName, which does not include the organization. So the orgID cannot
65
+ // be inferred from the URL. Until this is resolved, assume the group is in the default org.
66
+ const groupQuery = useQuery ( group ( organization ?? "default" , groupName ) ) ;
64
67
const groupData = groupQuery . data ;
65
68
const { data : permissions } = useQuery (
66
69
groupData !== undefined
You can’t perform that action at this time.
0 commit comments