66 * LICENSE file in the root directory of this source tree.
77 */
88const { refreshAccessToken, sessionValid, logout, LOGIN_SUCCESS , LOGOUT } = require ( '../actions/security' ) ;
9- const { loadMapConfig, configureError} = require ( '../actions/config' ) ;
9+ const { loadMapConfig, configureError, MAP_CONFIG_LOAD_ERROR } = require ( '../actions/config' ) ;
1010const { mapIdSelector} = require ( '../selectors/map' ) ;
1111const { hasMapAccessLoadingError} = require ( '../selectors/mapInitialConfig' ) ;
1212const { initCatalog} = require ( '../actions/catalog' ) ;
13+ const { setControlProperty} = require ( '../actions/controls' ) ;
1314const { pathnameSelector} = require ( '../selectors/routing' ) ;
15+ const { isLoggedIn} = require ( '../selectors/security' ) ;
1416const ConfigUtils = require ( '../utils/ConfigUtils' ) ;
1517const AuthenticationAPI = require ( '../api/GeoStoreDAO' ) ;
1618const Rx = require ( 'rxjs' ) ;
@@ -54,6 +56,13 @@ const reloadMapConfig = (action$, store) =>
5456 return Rx . Observable . of ( configureError ( e ) ) ;
5557 } ) ;
5658
59+ const promtLoginOnMapError = ( actions$ , store ) =>
60+ actions$ . ofType ( MAP_CONFIG_LOAD_ERROR )
61+ . filter ( ( action ) => action . error && action . error . status === 403 && ! isLoggedIn ( store . getState ( ) ) )
62+ . switchMap ( ( ) => {
63+ return Rx . Observable . of ( setControlProperty ( 'LoginForm' , 'enabled' , true , true ) ) ;
64+ } ) ;
65+
5766const initCatalogOnLoginOutEpic = ( action$ ) =>
5867 action$ . ofType ( LOGIN_SUCCESS , LOGOUT )
5968 . switchMap ( ( ) => {
@@ -68,5 +77,6 @@ const initCatalogOnLoginOutEpic = (action$) =>
6877module . exports = {
6978 refreshTokenEpic,
7079 reloadMapConfig,
80+ promtLoginOnMapError,
7181 initCatalogOnLoginOutEpic
7282} ;
0 commit comments