Comments & Discussion
JG
Hello, how can i use this can() method in 'script' section? For example i have AppMenu.vue component in which i manage my menu buttons for routing, and i want to hide some of them depends on permission. This example throws undefined error and i don't understand why. (rewrite to export default function can() solves this problem - works in script and template)
I think there's a typo: we should use page.props.permissions instead of page.props.auth.permissions here
const can = (permission) => { return page.props.permissions.includes(permission) }
why do you think that way?