Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

253
Vistas
How do i add id to success handler response and return the payload in .js?

I have to write a entitiesService.add function with the conditions below. I have the image of the bug that I am trying to clear. I have payload in the response but it does not include the id. I need to add id but I am not how since they only let me use the parameter payload.

Bug Picture Link

  • The parameters names: payload
  • The add function should implement a success handler with a call to .then.
  • The function provided to the .then should return capture the newly created id from the response and attach it as a new property to the payload
  • The function provided to the .then should return the payload that was originally passed into the top level function

.

entitiesService.add = (payload) => {
    console.log("addEntities is executing", payload);

    const config = {
        method: "POST",
        url: entitiesService.endpoint,
        data: payload,
        crossdomain: true,
        headers: {
            "Content-Type": "application/json"
        },
    };

    return axios(config).then(response => {
        return payload
    })
};
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda