diff --git a/src/containers/app.jsx b/src/containers/app.jsx
index a0fce75..5a4ece2 100644
--- a/src/containers/app.jsx
+++ b/src/containers/app.jsx
@@ -1,18 +1,21 @@
-import React, { Component } from 'react';
+import React, {Component} from 'react';
import {
Switch,
Route,
} from 'react-router-dom';
-import { AppRoutes } from '../routes';
+import {AppRoutes} from '../routes';
class App extends Component {
render() {
return (
{
- AppRoutes.map((prop, key) => (
-
- ))
+ AppRoutes.map((prop, key) => {
+ if (prop.exact) {
+ return
+ }
+ return
+ })
}
);
diff --git a/src/containers/auth.jsx b/src/containers/auth.jsx
index eb0c56b..dadd89e 100644
--- a/src/containers/auth.jsx
+++ b/src/containers/auth.jsx
@@ -1,11 +1,11 @@
-import React, { Component } from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {
Switch,
Route,
} from 'react-router-dom';
-import { connect } from 'react-redux';
-import { AuthRoutes } from '../routes';
+import {connect} from 'react-redux';
+import {AuthRoutes} from '../routes';
import {
MainLoaderSpinner,
Notifications,
@@ -19,7 +19,7 @@ class Auth extends Component {
}
getPageClass() {
- const { location } = this.props;
+ const {location} = this.props;
let pageClass = '';
if (location.pathname === '/login') {
pageClass = ' login-page';
@@ -30,22 +30,25 @@ class Auth extends Component {
}
render() {
- const { loaderStatus } = this.props;
+ const {loaderStatus} = this.props;
return (
-
-
+
+
{
- AuthRoutes.map((prop, key) => (
-
- ))
+ AuthRoutes.map((prop, key) => {
+ if (prop.exact) {
+ return
+ }
+ return
+ })
}
-
+
);
diff --git a/src/containers/dashboard.jsx b/src/containers/dashboard.jsx
index 10a5cc2..cd2a372 100644
--- a/src/containers/dashboard.jsx
+++ b/src/containers/dashboard.jsx
@@ -1,4 +1,4 @@
-import React, { Component } from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {
Switch,
@@ -6,9 +6,9 @@ import {
Redirect,
} from 'react-router-dom';
import _ from 'lodash';
-import { bindActionCreators } from 'redux';
-import { connect } from 'react-redux';
-import { DashboardRoutes } from '../routes';
+import {bindActionCreators} from 'redux';
+import {connect} from 'react-redux';
+import {DashboardRoutes} from '../routes';
import * as userActionCreators from '../redux/actions/user-actions';
import {
MainLoaderSpinner,
@@ -18,12 +18,12 @@ import {
Footer,
Restricted,
} from '../components';
-import { getCookie, validateCookie } from '../services';
-import { canActivate } from '../utils';
+import {getCookie, validateCookie} from '../services';
+import {canActivate} from '../utils';
class Dashboard extends Component {
componentDidMount() {
- const { actions } = this.props;
+ const {actions} = this.props;
if (validateCookie()) {
actions.users.setLoggedInUser(getCookie().username);
actions.users.setLoggedInUserUsername(getCookie().username);
@@ -31,11 +31,11 @@ class Dashboard extends Component {
}
render() {
- const { loaderStatus, loggedInUser } = this.props;
+ const {loaderStatus, loggedInUser} = this.props;
return (
-
-
+
+
@@ -43,19 +43,42 @@ class Dashboard extends Component {
{
DashboardRoutes.map((prop, key) => {
if (prop.collapse) {
- return prop.views.map((innerProp, key) => (
-
{
+ if(prop.exact) {
+ return ( (canActivate(loggedInUser, prop.restrictionLevel)
+ ?
+ : )}
+ key={key}
+ exact
+ />);
+ }
+ return ( (canActivate(loggedInUser, prop.restrictionLevel)
?
- : )}
+ : )}
key={key}
- />
- ));
+ />);
+ });
}
if (prop.redirect) {
return (
-
+
+ );
+ }
+ if (prop.exact) {
+ return (
+ (canActivate(loggedInUser, prop.restrictionLevel)
+ ?
+ : )
+ }
+ key={key}
+ exact
+ />
);
}
return (
@@ -63,8 +86,8 @@ class Dashboard extends Component {
path={prop.path}
render={() => (canActivate(loggedInUser, prop.restrictionLevel)
?
- : )
- }
+ : )
+ }
key={key}
/>
);