I am currently facing an issue where I am attempting to include an argument within getters in order to retrieve the ID of the permissions, but unfortunately it is not returning any results.
////STATE
state: {
permissions: [
{id: 1, name: 'Create User'},
{id: 2, name: 'Delete User'},
{id: 3, name: 'UpdateUser'}
]
}
//// GETTERS
getters: {
getPermissionById: state => id => {
return state.permissions.find(p => p.id=== id) // I attempted using "=="
}
}
Instead of the desired result, I am receiving getPermissionById:ƒ (id)
. I'm uncertain about what I may have overlooked.
Within the component:
computed: {
...mapGetters('permissionStore', ['getPermissionById'])
}
I am utilizing Vue Devtools to inspect the state.