反应本机网络错误GET请求不起作用

时间:2020-03-22 22:30:04

标签: android react-native android-studio

我遇到了一个问题,向我的nodejs服务器发送请求(使用axios)不起作用

enter image description here

这是代码

onPressLogin = () => {
    axios
      .post(
        'http://192.168.1.201:3000/v1/user/login',
        qs.stringify({
          email: this.state.email,
          password: this.state.password,
        }),
      )
      .then(res => {
        console.log(res)
        if (res.status === 200) {
          this.props.navigation.navigate('HomeScreen')
        } else {
          alert('Erreur de connexion')
        }
      })
      .catch(error => {
        console.error(error)
      })
      .done()
  }

我使用了10.0.2.2,我的主机IP地址(与邮递员一起工作),但在该应用程序上没有结果

0 个答案:

没有答案
相关问题