Skip to content

Instantly share code, notes, and snippets.

@BlackMix
Last active November 14, 2017 03:01
Show Gist options
  • Save BlackMix/36c82a6e889381ba709f2ec2257f791c to your computer and use it in GitHub Desktop.
Save BlackMix/36c82a6e889381ba709f2ec2257f791c to your computer and use it in GitHub Desktop.
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