Ivan - Add maintenance mode structure [skip ci]
This commit is contained in:
parent
bac7ea444e
commit
e842755b9e
|
@ -59,6 +59,14 @@ class App extends React.Component {
|
|||
loggedInStaff: !_.includes(props.location.pathname, '/admin/panel') && props.session.logged && props.session.staff,
|
||||
loggedOutStaff: _.includes(props.location.pathname, '/admin/panel') && !props.session.logged
|
||||
};
|
||||
|
||||
if(props.config['maintenance-mode'] && !_.includes(props.location.pathname, '/admin') && !_.includes(props.location.pathname, '/maintenance')) {
|
||||
browserHistory.push('/maintenance');
|
||||
}
|
||||
|
||||
if(!props.config['maintenance-mode'] && _.includes(props.location.pathname, '/maintenance')) {
|
||||
browserHistory.push('/');
|
||||
}
|
||||
|
||||
if (validations.languageChanged) {
|
||||
browserHistory.push(props.location.pathname);
|
||||
|
|
|
@ -11,6 +11,7 @@ import MainLayout from 'app/main/main-layout';
|
|||
import MainHomePage from 'app/main/main-home/main-home-page';
|
||||
import MainSignUpPage from 'app/main/main-signup/main-signup-page';
|
||||
import MainRecoverPasswordPage from 'app/main/main-recover-password/main-recover-password-page';
|
||||
import MainMaintenancePage from 'app/main/main-maintenance-page';
|
||||
|
||||
import DashboardLayout from 'app/main/dashboard/dashboard-layout';
|
||||
import DashboardListTicketsPage from 'app/main/dashboard/dashboard-list-tickets/dashboard-list-tickets-page';
|
||||
|
@ -59,6 +60,7 @@ export default (
|
|||
<IndexRoute component={MainHomePage} />
|
||||
<Route path='signup' component={MainSignUpPage}/>
|
||||
<Route path='recover-password' component={MainRecoverPasswordPage}/>
|
||||
<Route path='maintenance' component={MainMaintenancePage}/>
|
||||
<Route path='dashboard' component={DashboardLayout}>
|
||||
<IndexRoute component={DashboardListTicketsPage} />
|
||||
<Route path='articles' component={DashboardListArticlesPage}/>
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
import React from 'react';
|
||||
|
||||
class MainMaintenancePage extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
Maintenance
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default MainMaintenancePage;
|
|
@ -8,6 +8,7 @@ module.exports = [
|
|||
data: {
|
||||
'language': 'en',
|
||||
'reCaptchaKey': '6LfM5CYTAAAAAGLz6ctpf-hchX2_l0Ge-Bn-n8wS',
|
||||
'maintenance-mode': false,
|
||||
'departments': [
|
||||
{id: 1, name: 'Sales Support', owners: 2},
|
||||
{id: 2, name: 'Technical Issues', owners: 5},
|
||||
|
|
|
@ -33,7 +33,7 @@ store.dispatch(SessionActions.initSession());
|
|||
let unsubscribe = store.subscribe(() => {
|
||||
console.log(store.getState());
|
||||
|
||||
if (store.getState().session.initDone) {
|
||||
if (store.getState().session.initDone && store.getState().config.initDone) {
|
||||
unsubscribe();
|
||||
renderApplication();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,8 @@ class ConfigReducer extends Reducer {
|
|||
|
||||
getInitialState() {
|
||||
return {
|
||||
language: sessionStore.getItem('language')
|
||||
language: sessionStore.getItem('language'),
|
||||
initDone: false
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -35,7 +36,8 @@ class ConfigReducer extends Reducer {
|
|||
}));
|
||||
|
||||
return _.extend({}, state, payload.data, {
|
||||
language: currentLanguage || payload.language
|
||||
language: currentLanguage || payload.language,
|
||||
initDone: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue