Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!