Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot see the Axios result in the then, catch, and finally methods. #6332

Open
berkozagir opened this issue Mar 28, 2024 · 0 comments
Open

Comments

@berkozagir
Copy link

berkozagir commented Mar 28, 2024

Describe the bug

"I didn't have any problems with Axios get/post requests before. After the latest update, the Axios requests are successful, I check from the network and the successful response values are returning correctly, everything is fine when I try from Postman. However, after making the Axios request from React Native, the then, catch, and finally methods are not working, and I am unable to process the received result."

Ekran Resmi 2024-03-28 22 18 30
Ekran Resmi 2024-03-28 22 18 52
Ekran Resmi 2024-03-28 22 19 16

To Reproduce

No response

Code snippet

async function onLogin(email, password) {
  try {
    console.log('a');
    await axios
      .post('http://localhost:3000/api/login', {
        email: email,
        password: password,
      })
      .then(response => {
        console.log(response.data);
        if (!response || !response.data) {
          Alert.alert('Sorun oluştu, lütfen daha sonra tekrar deneyin.');
          return;
        }
        if (response.data.isSuccess) {
          Alert.alert(response.data?.value?.token);
          // navigation.navigate('Home');
        } else {
          Alert.alert(response.data.message);
        }
      })
      .catch(function (error) {
        console.log(error);
      })
      .finally(() => {
        console.log('asd');
      });
  } catch (e) {
    console.log(e);
  }
}

Expected behavior

No response

Axios Version

1.6.8

Adapter Version

No response

Browser

No response

Browser Version

No response

Node.js Version

21.7.1

OS

iOS 17

Additional Library Versions

React Native 0.73.4

Additional context/Screenshots

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant