Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

228
Views
¿Por qué VaadinRouter me enruta cuando no estoy autenticado?

Estoy jugando con VaadinRouter, tratando de proteger las rutas. A continuación puede ver el código onBeforeEnter de mi componente para proteger:

 authenticatedDummy = true; public onBeforeEnter( location: RouterLocation, commands: PreventAndRedirectCommands ): Promise<unknown> | RedirectResult | undefined { if (this.authenticatedDummy) { console.log('OnBeforeEnter'); return new Promise(resolve => { setTimeout(() => { resolve(commands.redirect('/home')); }, 2000); }); } return undefined; }

No entiendo por qué el enrutador me enruta, si authenticatedDummy es falso. Mientras leo el código, if authenticatedDummy is true, redirect me to '/home' .

¿Es esta la forma correcta de leerlo o estoy pasando por alto algo?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

He construido el script mal. Debería haber sido:

 public onBeforeEnter( location: RouterLocation, commands: PreventAndRedirectCommands ): Promise<unknown> | RedirectResult | undefined { if (!this.isAuthorized()) { console.log('Guarded!'); return new Promise(resolve => { setTimeout(() => { resolve(commands.redirect('/')); }, 2000); }); } return undefined; }

¡Está funcionando así!

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!