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

242
Views
Why am I unable to get response from my api using #apisauce?

Response is always returning undefined. I'm calling simple log in service using #apisauce in my react native app. Here's my implementation.

This is the handleSubmit method.

import loginApi from '../api/loginApi';

const handleSubmit = async ({email, password}) => {
    const result = await loginApi.login(email, password);
    console.log(result);
    console.log(result.data);
  };

Here is the Api call

import {create} from 'apisauce';

const apiClient = create({
  method: 'POST',
  baseURL: 'https://...',
  timeout: 10000,
});

export default apiClient;

And here's the api layer for login.

import apiClient from './client';

const loginApi = (email, password) => {
  apiClient.post('/login', {email, password});
};

export default {loginApi };

result always remains undefined. No error, no exceptions, nothing is coming in the result. I've checked the URLs, prams etc on #postman a number of times and everything is alright.

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

0

Result remains undefined because you're not returning anything from your loginApi.login() function.

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!