Last active
November 14, 2017 03:01
-
-
Save BlackMix/36c82a6e889381ba709f2ec2257f791c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import store from 'genesis/infra/store/index' | |
import menu from 'src/bootstrap/menus/drawer' | |
import options from 'src/bootstrap/menus/options' | |
import configurePath from 'src/bootstrap/configure/path' | |
import { APP_USER } from 'genesis/support/index' | |
import { get as git } from 'genesis/infra/storage' | |
const user = git(APP_USER) | |
import { get } from 'lodash' | |
/** | |
* @param {Vue} $component | |
*/ | |
export default ($component) => { | |
if (Array.isArray(menu(configurePath))) { | |
// novo object menu | |
let newmenu = menu(configurePath).filter((el) => { | |
// verifica se os menus tem namespace | |
if (el.namespace) { | |
console.log('map el primare array namespace', el) | |
} | |
// verifica se tem subs menus | |
if (el.children) { | |
el.children.filter((children) => { | |
// verifica se os subs menus tem namespace | |
if (children.namespace) { | |
if (!get(user.permissions, children.namespace, false)) { | |
console.log(children.namespace) | |
} | |
} | |
}) | |
} | |
return el | |
}) | |
store.dispatch('setAppMenu', newmenu) | |
} | |
// noinspection JSIgnoredPromiseFromCall | |
store.dispatch('setDashboardOptions', options()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment