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

462
Views
TypeError: la devolución de llamada no es una devolución de llamada de error de función

Sigo encontrándome con este error de devolución de llamada al intentar probar la publicación de datos en mi base de datos. No estoy seguro de la causa y he estado tratando de depurar un poco. ¿Podría ser porque le estoy pasando un error y el error de envío no está definido? Parece estar conectado correctamente en mi método.

Una de las devoluciones de llamada en la parte inferior del código me está dando el error. Es la devolución de llamada catch que me dice que la devolución de llamada no es una función. Tengo este mismo código funcionando bien en otro proyecto.

 import axios from "axios" import apiBaseUrl from "../../utils/apiBaseUrl.js" export default function(title, customer, description, billed, tags, location, notes, images, jobtype, callback) { axios.post(`${apiBaseUrl}/jobs/create-new`, { title: title, customer: customer, description: description, billed: billed, tags: tags, location: location, notes: notes, jobtype: jobtype, images: images }, { withCredentials: true }) .then(function(response) { callback(response.data) }) .catch(function(error) { callback({submitError: true}) }) }

Este es el lado de la API:

 createNewJob: function(title, customer, description, billed, tags, location, notes, images, jobtype, callback) { JobModel.findOne({$or: [{title: title}, {customer: customer}]}).exec(function(error, job) { if (error) { callback({submitError: true}) } else if (job) { callback({alreadyExistsError: true}) } else { const arrayOfTags = tags.split(",").map(function(tag){ return tag.trim() }) const arrayOfNotes = notes.split(",").map(function(note){ return note.trim() }) } const newJob = new JobModel({ id:randomstring.generate(12), title: title, customer: customer, description: description, billed: billed, tags: arrayOfTags, location: location, notes: arrayOfNotes, jobtype: jobtype, images: images }) newJob.save(function(saveError) { if(saveError) { callback({submitError: true}) } else { callback({success:true}) } }) }) }
about 4 years ago · Juan Pablo Isaza
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!