From bea8d9d1fcb16050876e9da3474ddaac813565fd Mon Sep 17 00:00:00 2001 From: brianbrix Date: Mon, 18 May 2026 09:32:44 +0300 Subject: [PATCH] AMP-31123:Issue-Share M&E dashboard- open link leads to login page --- .../ndddashboard/components/NDDDashboard.router.jsx | 2 +- .../modules/ndddashboard/components/NDDDashboardHome.jsx | 4 ++-- .../src/modules/ndddashboard/components/StartUp.jsx | 9 ++++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/amp/TEMPLATE/reampv2/packages/reampv2-app/src/modules/ndddashboard/components/NDDDashboard.router.jsx b/amp/TEMPLATE/reampv2/packages/reampv2-app/src/modules/ndddashboard/components/NDDDashboard.router.jsx index f59acf676b5..a0a58ab4a75 100755 --- a/amp/TEMPLATE/reampv2/packages/reampv2-app/src/modules/ndddashboard/components/NDDDashboard.router.jsx +++ b/amp/TEMPLATE/reampv2/packages/reampv2-app/src/modules/ndddashboard/components/NDDDashboard.router.jsx @@ -8,7 +8,7 @@ class NDDDashboardRouter extends Component { return ( } /> - } /> + } /> ); } diff --git a/amp/TEMPLATE/reampv2/packages/reampv2-app/src/modules/ndddashboard/components/NDDDashboardHome.jsx b/amp/TEMPLATE/reampv2/packages/reampv2-app/src/modules/ndddashboard/components/NDDDashboardHome.jsx index bf9afb5121f..13a13c2b74e 100755 --- a/amp/TEMPLATE/reampv2/packages/reampv2-app/src/modules/ndddashboard/components/NDDDashboardHome.jsx +++ b/amp/TEMPLATE/reampv2/packages/reampv2-app/src/modules/ndddashboard/components/NDDDashboardHome.jsx @@ -53,8 +53,8 @@ const NDDDashboardHome = (props) => { const fetchFmReducer = useSelector(state => state.fetchFmReducer); - const nddDashboard = !!fetchFmReducer.data.find(d => d === NDDPath); - const meDashboard = !!fetchFmReducer.data.find(d => d === MEPath); + const nddDashboard = !!fetchFmReducer.data?.find(d => d === NDDPath); + const meDashboard = !!fetchFmReducer.data?.find(d => d === MEPath); const getSharedDataOrResolve = (id) => { if (id) { diff --git a/amp/TEMPLATE/reampv2/packages/reampv2-app/src/modules/ndddashboard/components/StartUp.jsx b/amp/TEMPLATE/reampv2/packages/reampv2-app/src/modules/ndddashboard/components/StartUp.jsx index ed7aa79594a..ea73465cb7b 100755 --- a/amp/TEMPLATE/reampv2/packages/reampv2-app/src/modules/ndddashboard/components/StartUp.jsx +++ b/amp/TEMPLATE/reampv2/packages/reampv2-app/src/modules/ndddashboard/components/StartUp.jsx @@ -23,8 +23,10 @@ const Startup = (props) => { _fetchTranslations, programConfigurationPending, fmReducerPending, + fmReducerError, sectorClassificationPending, - settingsPending + settingsPending, + settingsError } = props; const dispatch = useDispatch(); @@ -39,6 +41,9 @@ const Startup = (props) => { if (translationPending || programConfigurationPending || fmReducerPending || sectorClassificationPending || settingsPending) { return (); + } else if (fmReducerError || settingsError) { + window.location.replace('/login.do'); + return null; } else { document.title = translations['amp.ndd.dashboard:page-title']; return ( @@ -54,8 +59,10 @@ const mapStateToProps = state => ({ translations: state.translationsReducer.translations, programConfigurationPending: state.programConfigurationReducer.loading, fmReducerPending: state.fetchFmReducer.loading, + fmReducerError: state.fetchFmReducer.error, sectorClassificationPending: state.fetchSectorClassificationReducer.loading, settingsPending: state.fetchSettingsReducer.loading, + settingsError: state.fetchSettingsReducer.error, }); const mapDispatchToProps = dispatch => bindActionCreators({