update map function to be chained

This commit is contained in:
John Mitchell
2018-12-04 11:33:04 -05:00
committed by Marliana Lara
parent f83b59cb48
commit 00c9ae1376

View File

@@ -57,11 +57,11 @@ const SideNavItems = ({ items, history }) => {
const currentPath = history.location.pathname.replace(/^\//, '');
let activeGroup;
if (currentPath !== '') {
const groupPaths = items.map(({ groupName, routes }) => ({
groupName,
paths: routes.map(({ path }) => path)
}));
[{ groupName: activeGroup }] = groupPaths
[{ groupName: activeGroup }] = items
.map(({ groupName, routes }) => ({
groupName,
paths: routes.map(({ path }) => path)
}))
.filter(({ paths }) => paths.indexOf(currentPath) > -1);
} else {
activeGroup = 'views';