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

83
Views
ReactJS getting results from a Promise

In my sagas, I am sending user credentials to the backend

const request = client.post('api/JwtAuth/GenerateToken', {UserName: action.username, Password: action.password})
console.log(request) 

client looks like this

import axios from "axios"

const client = axios.create({
    baseURL: 'https://localhost:5001/',
    timeout: 600000000000,
    headers: {
        ContentType: 'application/json'
    }
})

export default client

Chrome Browser console

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

0

what is your question? If the question why are you seeing Promise on the console? That's because you are dealing with promises, either use .then

client.post().then(res => console.log(res.data)).catch(err => console.log(err))

or async await syntax

await client.post()
about 4 years ago · Juan Pablo Isaza Report

0

  const request = client.post('api/JwtAuth/GenerateToken', {UserName: 
    action.username, Password: action.password})

  request.then(response => {
    // the response body can be accessed through the "data" property
    console.log(response.data)
  })
  console.log(request) 

UPDATE:

You are doing this inside a saga, right? If so, the best way to get the request response data is to use the call effect. Import it from redux-saga/effects, and get the response like this:

  const response = yield call(
    client.post,
    'api/JwtAuth/GenerateToken',
    { UserName: action.username, Password: action.password }
  )

  console.log(response.data)
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!