Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

146
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda