File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
site/src/pages/ManagementSettingsPage Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -61,10 +61,11 @@ export const ManagementSettingsLayout: FC = () => {
61
61
currentOrganizationId : ! inOrganizationSettings
62
62
? undefined
63
63
: ! organization
64
- ? "00000000-0000-0000-0000-000000000000"
65
- : organizationsQuery . data . find (
66
- ( org ) => org . name === organization ,
67
- ) ?. id ,
64
+ ? getOrganizationIdByDefault ( organizationsQuery . data )
65
+ : getOrganizationIdByName (
66
+ organizationsQuery . data ,
67
+ organization ,
68
+ ) ,
68
69
organizations : organizationsQuery . data ,
69
70
} }
70
71
>
@@ -93,3 +94,9 @@ export const ManagementSettingsLayout: FC = () => {
93
94
</ RequirePermission >
94
95
) ;
95
96
} ;
97
+
98
+ const getOrganizationIdByName = ( organizations : Organization [ ] , name : string ) =>
99
+ organizations . find ( ( org ) => org . name === name ) ?. id ;
100
+
101
+ const getOrganizationIdByDefault = ( organizations : Organization [ ] ) =>
102
+ organizations . find ( ( org ) => org . is_default ) ?. id ;
You can’t perform that action at this time.
0 commit comments