...
 
Commits (2)
...@@ -3,16 +3,16 @@ import Loadable from 'utilities/CustomReactLoadable'; ...@@ -3,16 +3,16 @@ import Loadable from 'utilities/CustomReactLoadable';
const publicRoutes = [ const publicRoutes = [
{ {
path: '/wiews/:filterCode(v.+)?', path: '/wiews/:wiewsCode([a-zA-Z]+[0-9]+)',
component: Loadable({ component: Loadable({
loader: () => import(/* webpackMode:"lazy", webpackChunkName: "institutes" */'institutes/ui/BrowsePage'), loader: () => import(/* webpackMode:"lazy", webpackChunkName: "institutes" */'institutes/ui/DisplayPage'),
}), }),
exact: true, exact: true,
}, },
{ {
path: '/wiews/:wiewsCode([a-zA-Z]+[0-9]+)', path: '/wiews/:filterCode(v.+)?',
component: Loadable({ component: Loadable({
loader: () => import(/* webpackMode:"lazy", webpackChunkName: "institutes" */'institutes/ui/DisplayPage'), loader: () => import(/* webpackMode:"lazy", webpackChunkName: "institutes" */'institutes/ui/BrowsePage'),
}), }),
exact: true, exact: true,
}, },
......
...@@ -118,8 +118,10 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> { ...@@ -118,8 +118,10 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> {
} }
public componentWillMount() { public componentWillMount() {
const { code, loadInstitute, userRoles } = this.props; const { code, loadInstitute, institute, userRoles } = this.props;
if (code && (! institute || code !== institute.details.code)) {
loadInstitute(code); loadInstitute(code);
}
const authenticated: boolean = userRoles.findIndex((role) => role === 'ROLE_USER') !== -1; const authenticated: boolean = userRoles.findIndex((role) => role === 'ROLE_USER') !== -1;
this.setState({authenticated}); this.setState({authenticated});
......