Commit 0c4ae59c authored by Maxym Borodenko's avatar Maxym Borodenko

FIX: extra call to institute details in SSR

parent 98eb1f8a
......@@ -3,16 +3,16 @@ import Loadable from 'utilities/CustomReactLoadable';
const publicRoutes = [
{
path: '/wiews/:filterCode(v.+)?',
path: '/wiews/:wiewsCode([a-zA-Z]+[0-9]+)',
component: Loadable({
loader: () => import(/* webpackMode:"lazy", webpackChunkName: "institutes" */'institutes/ui/BrowsePage'),
loader: () => import(/* webpackMode:"lazy", webpackChunkName: "institutes" */'institutes/ui/DisplayPage'),
}),
exact: true,
},
{
path: '/wiews/:wiewsCode([a-zA-Z]+[0-9]+)',
path: '/wiews/:filterCode(v.+)?',
component: Loadable({
loader: () => import(/* webpackMode:"lazy", webpackChunkName: "institutes" */'institutes/ui/DisplayPage'),
loader: () => import(/* webpackMode:"lazy", webpackChunkName: "institutes" */'institutes/ui/BrowsePage'),
}),
exact: true,
},
......
......@@ -118,8 +118,10 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> {
}
public componentWillMount() {
const { code, loadInstitute, userRoles } = this.props;
loadInstitute(code);
const { code, loadInstitute, institute, userRoles } = this.props;
if (code && (! institute || code !== institute.details.code)) {
loadInstitute(code);
}
const authenticated: boolean = userRoles.findIndex((role) => role === 'ROLE_USER') !== -1;
this.setState({authenticated});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment