fix(cp-frontend): Pass full paths to menu items

This commit is contained in:
JUDIT GRESKOVITS 2017-07-13 14:21:31 +01:00 committed by Sérgio Ramos
parent 1533bf5d6e
commit fe760dcca6
1 changed files with 13 additions and 2 deletions

View File

@ -2,8 +2,19 @@ import React from 'react';
import { connect } from 'react-redux';
import { Menu as MenuComponent } from '@components/navigation';
const Menu = ({ sections }) =>
sections && sections.length ? <MenuComponent links={sections} /> : null;
const Menu = ({match, sections}) => {
if(!sections || !sections.length) {
return null;
}
const sectionsWithPathnames = sections.map(section => {
return {
name: section.name,
pathname: `${match.url}/${section.pathname}`
};
});
return <MenuComponent links={sectionsWithPathnames} /> ;
}
const ConnectedMenu = connect(
(state, ownProps) => {