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

170
Visualizações
React Native - making if inside dispatch to decide to send variable / not

I am currently trying to use an API. From what I tested in postman, the server got internal error (status: 500) if I send voucher_id with data that is not recognized (it only accept 1 & 2, the rest is not acceptable). If I remove voucher_id in the postman, the code works properly (from what I see, it has no problem if no voucher_id. The API gives different response compared to when it has voucher_id). So I want to make if to check whether I can remove voucher_id or not.

<TouchableOpacity
      onPress={() => {
        dispatch(
          PaymentAssesment({
            project_id: params.id,
            name: params.name,
            voucher_id: disc ? disc.id : '',
          }),
        );
      }}>
      <Text style={styles.itemButton}>Lanjutkan</Text>
    </TouchableOpacity>

This is the code I got and I wonder how to change this to make if to either include voucher_id or just remove it

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