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

248
Views
¿Cómo manejar el token JWT de inicio de sesión en Vue JS?

Tengo un token en mi almacenamiento local . si elimino el token en localstorage , entonces no voy a cerrar la sesión. ¿Puedes sugerirme un ejemplo de cómo hacerlo?

 created() { if (this.vueToken) { let headers = { Authorization: "Bearer " + localStorage.getItem("vueToken"), }; axios .get("checkLogin", { headers: headers, }) .then((response) => response); }else{ this.$router.push('/login') } },
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Debe configurar una condición en sus rutas seguras, por ejemplo, si el token es nulo en su almacenamiento local, lo enviará al almacenamiento local. Aquí hay un código de ejemplo.

 mounted() { this.token = localStorage.getItem("ivToken"); if(this.token===null){ this.$router.push("/signin") }

},`

over 4 years ago · Santiago Trujillo 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!