@@ -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,18 +86,22 @@ type AppIndexProps = {
83
86
class AppIndex extends React . Component < AppIndexProps , any > {
84
87
componentDidMount ( ) {
85
88
this . props . getCurrentUser ( ) ;
86
- if ( ! history . location . pathname . startsWith ( "/invite/" ) ) {
87
- this . props . fetchConfig ( ) ;
88
- }
89
- 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 ) {
90
94
this . props . fetchHome ( ) ;
91
95
}
92
96
}
93
97
94
- componentDidUpdate ( ) {
98
+ componentDidUpdate ( prevProps : AppIndexProps ) {
95
99
if ( history . location . pathname === BASE_URL ) {
96
100
this . props . fetchHome ( ) ;
97
101
}
102
+ if ( prevProps . currentOrgId !== this . props . currentOrgId ) {
103
+ this . props . fetchConfig ( this . props . currentOrgId ) ;
104
+ }
98
105
}
99
106
100
107
render ( ) {
@@ -103,7 +110,7 @@ class AppIndex extends React.Component<AppIndexProps, any> {
103
110
// make sure all users in this app have checked login info
104
111
if (
105
112
! this . props . isFetchUserFinished ||
106
- this . props . isFetchingConfig ||
113
+ // this.props.isFetchingConfig ||
107
114
( pathname === BASE_URL && ! this . props . isFetchHomeFinished )
108
115
) {
109
116
const hideLoadingHeader = isTemplate || isAuthUnRequired ( pathname ) ;
@@ -153,6 +160,8 @@ class AppIndex extends React.Component<AppIndexProps, any> {
153
160
component = { ApplicationHome }
154
161
/>
155
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 } />
156
165
< LazyRoute path = { INVITE_LANDING_URL } component = { LazyInviteLanding } />
157
166
< LazyRoute path = { `${ COMPONENT_DOC_URL } /:name` } component = { LazyComponentDoc } />
158
167
< LazyRoute path = { `/playground/:name/:dsl` } component = { LazyComponentPlayground } />
@@ -176,8 +185,9 @@ class AppIndex extends React.Component<AppIndexProps, any> {
176
185
177
186
const mapStateToProps = ( state : AppState ) => ( {
178
187
isFetchUserFinished : isFetchUserFinished ( state ) ,
179
- isFetchingConfig : getSystemConfigFetching ( state ) ,
188
+ // isFetchingConfig: getSystemConfigFetching(state),
180
189
orgDev : state . ui . users . user . orgDev ,
190
+ currentOrgId : state . ui . users . user . currentOrgId ,
181
191
defaultHomePage : state . ui . application . homeOrg ?. commonSettings . defaultHomePage ,
182
192
isFetchHomeFinished : state . ui . application . loadingStatus . fetchHomeDataFinished ,
183
193
favicon : getBrandingConfig ( state ) ?. favicon
@@ -190,7 +200,7 @@ const mapDispatchToProps = (dispatch: any) => ({
190
200
getCurrentUser : ( ) => {
191
201
dispatch ( fetchUserAction ( ) ) ;
192
202
} ,
193
- fetchConfig : ( ) => dispatch ( fetchConfigAction ( ) ) ,
203
+ fetchConfig : ( orgId ?: string ) => dispatch ( fetchConfigAction ( orgId ) ) ,
194
204
fetchHome : ( ) => dispatch ( fetchHomeData ( { } ) ) ,
195
205
} ) ;
196
206
0 commit comments