@@ -13,6 +13,8 @@ import {
1313 IMPORT_APP_FROM_TEMPLATE_URL ,
1414 INVITE_LANDING_URL ,
1515 isAuthUnRequired ,
16+ ORG_AUTH_LOGIN_URL ,
17+ ORG_AUTH_REGISTER_URL ,
1618 QUERY_LIBRARY_URL ,
1719 SETTING ,
1820 TRASH_URL ,
@@ -70,10 +72,11 @@ const Wrapper = (props: { children: React.ReactNode }) => (
7072type AppIndexProps = {
7173 isFetchUserFinished : boolean ;
7274 isFetchHomeFinished : boolean ;
73- isFetchingConfig : boolean ;
75+ // isFetchingConfig: boolean;
76+ currentOrgId ?: string ;
7477 orgDev : boolean ;
7578 defaultHomePage : string | null | undefined ;
76- fetchConfig : ( ) => void ;
79+ fetchConfig : ( orgId ?: string ) => void ;
7780 getCurrentUser : ( ) => void ;
7881 fetchHome : ( ) => void ;
7982 favicon : string ;
@@ -83,16 +86,22 @@ type AppIndexProps = {
8386class AppIndex extends React . Component < AppIndexProps , any > {
8487 componentDidMount ( ) {
8588 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 ) {
8894 this . props . fetchHome ( ) ;
8995 }
9096 }
9197
92- componentDidUpdate ( ) {
98+ componentDidUpdate ( prevProps : AppIndexProps ) {
9399 if ( history . location . pathname === BASE_URL ) {
94100 this . props . fetchHome ( ) ;
95101 }
102+ if ( prevProps . currentOrgId !== this . props . currentOrgId ) {
103+ this . props . fetchConfig ( this . props . currentOrgId ) ;
104+ }
96105 }
97106
98107 render ( ) {
@@ -101,7 +110,7 @@ class AppIndex extends React.Component<AppIndexProps, any> {
101110 // make sure all users in this app have checked login info
102111 if (
103112 ! this . props . isFetchUserFinished ||
104- this . props . isFetchingConfig ||
113+ // this.props.isFetchingConfig ||
105114 ( pathname === BASE_URL && ! this . props . isFetchHomeFinished )
106115 ) {
107116 const hideLoadingHeader = isTemplate || isAuthUnRequired ( pathname ) ;
@@ -151,6 +160,8 @@ class AppIndex extends React.Component<AppIndexProps, any> {
151160 component = { ApplicationHome }
152161 />
153162 < 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 } />
154165 < LazyRoute path = { INVITE_LANDING_URL } component = { LazyInviteLanding } />
155166 < LazyRoute path = { `${ COMPONENT_DOC_URL } /:name` } component = { LazyComponentDoc } />
156167 < LazyRoute path = { `/playground/:name/:dsl` } component = { LazyComponentPlayground } />
@@ -174,8 +185,9 @@ class AppIndex extends React.Component<AppIndexProps, any> {
174185
175186const mapStateToProps = ( state : AppState ) => ( {
176187 isFetchUserFinished : isFetchUserFinished ( state ) ,
177- isFetchingConfig : getSystemConfigFetching ( state ) ,
188+ // isFetchingConfig: getSystemConfigFetching(state),
178189 orgDev : state . ui . users . user . orgDev ,
190+ currentOrgId : state . ui . users . user . currentOrgId ,
179191 defaultHomePage : state . ui . application . homeOrg ?. commonSettings . defaultHomePage ,
180192 isFetchHomeFinished : state . ui . application . loadingStatus . fetchHomeDataFinished ,
181193 favicon : getBrandingConfig ( state ) ?. favicon
@@ -188,7 +200,7 @@ const mapDispatchToProps = (dispatch: any) => ({
188200 getCurrentUser : ( ) => {
189201 dispatch ( fetchUserAction ( ) ) ;
190202 } ,
191- fetchConfig : ( ) => dispatch ( fetchConfigAction ( ) ) ,
203+ fetchConfig : ( orgId ?: string ) => dispatch ( fetchConfigAction ( orgId ) ) ,
192204 fetchHome : ( ) => dispatch ( fetchHomeData ( { } ) ) ,
193205} ) ;
194206
0 commit comments