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

265
Views
cómo pasar parámetros a api?reactjs

aquí está mi objetivo ... los valores provienen del inicio de sesión (puede ser cualquier cosa)-> por ejemplo, correo electrónico: 'aaaa@gmail.com' contraseña: '12345678'

debo tomar el nombre de usuario hasta "@" y pasarlo a api como nombre de usuario.

 export const loginUser = (values, history, setFieldError, setSubmitting) => { console.log("values from login", values) //here i take the email split value and take as user name const username = values.email.split("@")[0] console.log("user name", username) //now i should pass the username as a name parametr to api return () => { axios.get('https://api.agify.io/?', values ).then((response) => { //if res ok should redirect it console.log("response", response) // history.push("/user") }).catch(error => console.error(error)) setSubmitting(false); } }

si puede ayudar aquí está mi enlace https://codesandbox.io/s/charming-jang-py0mu?file=/src/auth/actions/userActions.js

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Creo que esto puede hacer el trabajo (usando literales de plantilla):

 axios.get(`https://api.agify.io/?name=${username}`)
about 4 years ago · Juan Pablo Isaza Report
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!