File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
client/packages/lowcoder/src/redux/selectors Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 1
1
import { Org } from "@lowcoder-ee/constants/orgConstants" ;
2
2
import { getUser } from "./usersSelectors" ;
3
3
import { AppState } from "redux/reducers" ;
4
+ import { getHomeOrg } from "./applicationSelector" ;
4
5
5
6
export const getOrgUsers = ( state : AppState ) => {
6
7
return state . ui . org . orgUsers ;
@@ -33,8 +34,14 @@ export const getOrgLastMonthApiUsage = (state: AppState) => {
33
34
// Add to usersSelectors.ts
34
35
export const getWorkspaces = ( state : AppState ) => state . ui . users . workspaces ;
35
36
36
- export const getCurrentOrg = ( state : AppState ) : Org | undefined => {
37
- const user = getUser ( state ) ;
38
- const workspaces = getWorkspaces ( state ) ;
39
- return workspaces . items . find ( org => org . id === user . currentOrgId ) ;
37
+ export const getCurrentOrg = ( state : AppState ) : Pick < Org , 'id' | 'name' > | undefined => {
38
+ const homeOrg = getHomeOrg ( state ) ;
39
+ if ( ! homeOrg ) {
40
+ return undefined ;
41
+ }
42
+
43
+ return {
44
+ id : homeOrg . id ,
45
+ name : homeOrg . name ,
46
+ } ;
40
47
} ;
You can’t perform that action at this time.
0 commit comments