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

169
Vistas
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 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