Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

145
Vistas
How manual url access can be prevented in Vue 2

I use the story mode in vue router (to expose the URL to the user), but I need to prevent the user from manually changing it, unless accessing a URL that they have already visited (from an app redirect).

If I have the following route with id parameter:

 { path: '/user/:id', name: 'User', component: User }

If the user accesses http://example/user/1 and http://example/user/2 from the application, he could access the 2 URLS manually, but if he changes the 'id' 2 to 3 (http://example/user/3) should not be able to access.

Although vue-router limits that the content is not modified if the user changes user/2 to user/3, when the user refreshes the page with F5 with the URL http://example/user/3, they access without restrictions.

I could save a list of visited routes in the store and validate using

router.beforeEach ((to, from, next) 

to verify that the route being accessed already exists in the list of visited routes, but I wanted to know if there is no functionality vue-router to solve it naturally.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda