Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

493
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda