Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

245
Visualizações
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 Respostas
Responde à pergunta

0

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

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda