I need to determine which routes to hide based on a condition that evaluates to true or false. I have a collection of routes, such as: - Products - Clients
For instance, if a user logs in but does not have the permission to edit products, then the updated list would only include: - Clients.
I am hiding certain routes based on their names using this syntax:
v-for="item in routes" v-if="item.name != 'Login"
.
To hide buttons, I apply the following approach:
AccionRegistrarProducto(){
var userData = JSON.parse(localStorage.getItem("usuario"));
var actions = userData.infoUser.Actions;
if(actions.some(a => a.Action === 'Add Products')){
this.actionAddProduct = true;
}
else{
this.actionAddProduct = false;
}
},
I aim to extend this logic to hide specific routes from the list.