Good evening.
I have the following route, where I receive a parameter through the ‘idservice’ route:
{
path: '/editarmiservicio/:idservicio',
component: EditarMiServicio,
beforeEnter: validacion
},
I have the following middleware:
function validacion(to, from, next) {
const router = this;
let usuario = firebase.auth().currentUser;
console.log("ESTA INTENTANDO INGRESAR A: ");
console.log(to.url);
if(to.url == '/mensajes/' || to.url == '/conversacion/' || to.url =="/editarmiservicio/:idservicio"){
if(usuario){
next();
}
else{
router.navigate('/entrar/');
}
}
else{
next();
}
}
but the path to.url == "/ edit my service /: idservice"
doesn’t work for me, since the console.log prints'edit my service / -Lh29vaFjkzi1Cu364pT'
, since: idservice is dynamic. Well, with the condition of validatingto.url == '/ messages /'
if it works correctly.
Beforehand thank you very much.
How can I correct such a situation?
Beforehand thank you very much.