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

717
Views
OBTENGA http://localhost:3000/api/auth/user/:id 401 (no autorizado)

Estoy usando vue3 con axios y prisma, pero tengo un problema para obtener la información del usuario.

Mi solicitud de cartero está bien (http://localhost:3000/api/auth/user/7), pero mi solicitud de axios no lo está.

Puedes ayudarme por favor ?

 async created () { const response = await axios.get('http://localhost:3000/api/auth/user/:id', { headers: { Authorization: 'Bearer ' + localStorage.getItem('token') } }); console.log('ici'); }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Axios no admite parámetros de URL.

Una solución sería utilizar cadenas de plantilla para crear la URL de solicitud.

Por ejemplo:

 function getID(id) { const response = await axios.get(`http://localhost:3000/api/auth/user/${id}`,{ headers: { Authorization: 'Bearer ' + localStorage.getItem('token') } }); } // getID(7);
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!