@@ -13,6 +13,8 @@ import {
13
13
IMPORT_APP_FROM_TEMPLATE_URL ,
14
14
INVITE_LANDING_URL ,
15
15
isAuthUnRequired ,
16
+ ORG_AUTH_LOGIN_URL ,
17
+ ORG_AUTH_REGISTER_URL ,
16
18
QUERY_LIBRARY_URL ,
17
19
SETTING ,
18
20
TRASH_URL ,
@@ -70,10 +72,11 @@ const Wrapper = (props: { children: React.ReactNode }) => (
70
72
type AppIndexProps = {
71
73
isFetchUserFinished : boolean ;
72
74
isFetchHomeFinished : boolean ;
73
- isFetchingConfig : boolean ;
75
+ // isFetchingConfig: boolean;
76
+ currentOrgId ?: string ;
74
77
orgDev : boolean ;
75
78
defaultHomePage : string | null | undefined ;
76
- fetchConfig : ( ) => void ;
79
+ fetchConfig : ( orgId ?: string ) => void ;
77
80
getCurrentUser : ( ) => void ;
78
81
fetchHome : ( ) => void ;
79
82
favicon : string ;
@@ -83,16 +86,22 @@ type AppIndexProps = {
83
86
class AppIndex extends React . Component < AppIndexProps , any > {
84
87
componentDidMount ( ) {
85
88
this . props . getCurrentUser ( ) ;
86
- this . props . fetchConfig ( ) ;
87
- if ( history . location . pathname === BASE_URL ) {
89
+ const { pathname } = history . location ;
90
+
91
+ this . props . fetchConfig ( this . props . currentOrgId ) ;
92
+
93
+ if ( pathname === BASE_URL ) {
88
94
this . props . fetchHome ( ) ;
89
95
}
90
96
}
91
97
92
- componentDidUpdate ( ) {
98
+ componentDidUpdate ( prevProps : AppIndexProps ) {
93
99
if ( history . location . pathname === BASE_URL ) {
94
100
this . props . fetchHome ( ) ;
95
101
}
102
+ if ( prevProps . currentOrgId !== this . props . currentOrgId ) {
103
+ this . props . fetchConfig ( this . props . currentOrgId ) ;
104
+ }
96
105
}
97
106
98
107
render ( ) {
@@ -101,7 +110,7 @@ class AppIndex extends React.Component<AppIndexProps, any> {
101
110
// make sure all users in this app have checked login info
102
111
if (
103
112
! this . props . isFetchUserFinished ||
104
- this . props . isFetchingConfig ||
113
+ // this.props.isFetchingConfig ||
105
114
( pathname === BASE_URL && ! this . props . isFetchHomeFinished )
106
115
) {
107
116
const hideLoadingHeader = isTemplate || isAuthUnRequired ( pathname ) ;
@@ -151,6 +160,8 @@ class AppIndex extends React.Component<AppIndexProps, any> {
151
160
component = { ApplicationHome }
152
161
/>
153
162
< LazyRoute path = { USER_AUTH_URL } component = { LazyUserAuthComp } />
163
+ < LazyRoute path = { ORG_AUTH_LOGIN_URL } component = { LazyUserAuthComp } />
164
+ < LazyRoute path = { ORG_AUTH_REGISTER_URL } component = { LazyUserAuthComp } />
154
165
< LazyRoute path = { INVITE_LANDING_URL } component = { LazyInviteLanding } />
155
166
< LazyRoute path = { `${ COMPONENT_DOC_URL } /:name` } component = { LazyComponentDoc } />
156
167
< LazyRoute path = { `/playground/:name/:dsl` } component = { LazyComponentPlayground } />
@@ -174,8 +185,9 @@ class AppIndex extends React.Component<AppIndexProps, any> {
174
185
175
186
const mapStateToProps = ( state : AppState ) => ( {
176
187
isFetchUserFinished : isFetchUserFinished ( state ) ,
177
- isFetchingConfig : getSystemConfigFetching ( state ) ,
188
+ // isFetchingConfig: getSystemConfigFetching(state),
178
189
orgDev : state . ui . users . user . orgDev ,
190
+ currentOrgId : state . ui . users . user . currentOrgId ,
179
191
defaultHomePage : state . ui . application . homeOrg ?. commonSettings . defaultHomePage ,
180
192
isFetchHomeFinished : state . ui . application . loadingStatus . fetchHomeDataFinished ,
181
193
favicon : getBrandingConfig ( state ) ?. favicon
@@ -188,7 +200,7 @@ const mapDispatchToProps = (dispatch: any) => ({
188
200
getCurrentUser : ( ) => {
189
201
dispatch ( fetchUserAction ( ) ) ;
190
202
} ,
191
- fetchConfig : ( ) => dispatch ( fetchConfigAction ( ) ) ,
203
+ fetchConfig : ( orgId ?: string ) => dispatch ( fetchConfigAction ( orgId ) ) ,
192
204
fetchHome : ( ) => dispatch ( fetchHomeData ( { } ) ) ,
193
205
} ) ;
194
206
0 commit comments