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

286
Views
vue 3 y axios devuelven un error con sobrecarga

Actualmente usando vue 3/ vite/ axios/ mecanografiado. Mi función funciona en dev. Sin embargo, en mi IDE devuelve un error en el ide y durante la compilación.

 get count() { axios({ method: "get", url: "/info/count", headers: authHeader(), }) .then((response) => { this.count = response.data.status; }); },

Error en IDE Pycharm

 TS2769: No overload matches this call.   Overload 1 of 2, '(config: AxiosRequestConfig<any>): AxiosPromise<any>', gave the following error.     Argument of type '{ method: "get"; url: string; headers: { Authorization: string; } | { Authorization?: undefined; }; }' is not assignable to parameter of type 'AxiosRequestConfig<any>'.       Object literal may only specify known properties, and 'headers' does not exist in type 'AxiosRequestConfig<any>'.   Overload 2 of 2, '(url: string, config?: AxiosRequestConfig<any>): AxiosPromise<any>', gave the following error.     Argument of type '{ method: string; url: string; headers: { Authorization: string; } | { Authorization?: undefined; }; }' is not assignable to parameter of type 'string

Valores en AuthHeader()

 export default function authHeader () { let user_token = localStorage.getItem('auth_user') let auth_token = localStorage.getItem('auth_token') if (user_token && auth_token) { return { 'Authorization': 'bearer ' + auth_token }; } else { return {}; } }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Pruebe los encabezados entre llaves {} , como en:

 axios({ method: "get", url: "/info/count", {headers: authHeader()}, }) .then((response) => { this.count = response.data.status; });
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!