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

491
Vistas
EXPO React Native - AXIOS + FORMDATA PROBLEM

i have an issue with POST request inside my app.

part of code :

if (imagesResults !== undefined) {
  imagesResults.forEach((el) => {
    let localUri = el.uri;
    let filename = localUri.split("/").pop();

    let match = /\.(\w+)$/.exec(filename);
    let type = match ? `image/${match[1]}` : `image`;
    formData.append("saleImages[]", {
      uri: localUri,
      name: filename,
      type: type,
    });
  });
}

console.log("FORMDATA", formData);

const axiosConfig = {
  headers: {
    Authorization: "Bearer  " + user.token,
    "content-type": "application/x-www-form-urlencoded",
    Accept: "application/json",
  },
};

try {
  axios
    .post(`${API}/sales/${saleId}/edit`, formData, axiosConfig)
    .then((res) => {
      // console.log("RES", JSON.stringify(res.data));
      bottomSheetRef.current.snapToIndex(0);
      setTimeout(() => {
        bottomSheetRef.current.close();
        dispatch(setLoadingApiAction(false));
        navigation.navigate("My Ads");
      }, 3000);
    })
    .catch((err) => {
      console.log("error", err);
      // setErrors(err.response.data.errors);
      navigation.navigate("My Ads");
      alert("SOMETHING IS WRONG!");
      dispatch(setLoadingApiAction(false));
    });
} catch (error) {
  console.log("ERROR CATCH", error);
  dispatch(setLoadingApiAction(false));
 }
};

so what is happening, i fire my API, and i get 200 but just after i get 200 it return me also a network error and goes into .catch part.

This is only happening in ANDROID DEVICE , IOS working totally fine.

I am using a HTTPS , also i tried to set type of the image hardcoded into "image/jpeg" but i got the same problem.

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