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

189
Visualizações
How can I redirect user to another page after login - Angular

In the project I'm working on, it's common to pass links to details of a purchase on email, but when the user opens the link it asks for authentication in the system, but after logging in, it is redirected to the home page (the system panel) and not for the purchase details.

if (admin) {
 that.router.navigate(['/main-panel'], { replaceUrl: true });
} else (seller) {
 that.router.navigate(['/main-panel-seller'], { replaceUrl: true });
}

The only validation I do is where I'm going to send this user, there is any way to check the previous url? Or somewhere where I can find this url information is stored.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

When you redirect the user to the login page you can pass the original url as params , and navigate to it when he's logged in

For example : in the auth gard

this.router.navigate(['login'], { queryParams: { returnUrl: state.url }});

and in the controller :

this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/'; 
his.router.navigateByUrl(this.returnUrl);

(Source)

about 4 years ago · Juan Pablo Isaza Relatório
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