将帖子发送到Django Rest Framework端点时,React Native axios调用引发错误

时间:2020-09-08 08:22:44

标签: react-native django-rest-framework axios

我有以下React Native方法:

 const handleSignupPress = async () => {
    try {
      newUser = {
        username: email, 
        email: email, 
        first_name: '', 
        last_name: '', 
        is_staff: false,
        is_active: true, 
        is_superuser: false
      };
      await axios.post('http://127.0.0.1:8000/api/access/users/', newUser);
    } catch (error) {
      console.log(error);
    }
  }

此方法会将帖子发送到可用且运行正常的Django Rest Framework端点,但是axios调用引发此错误:[Error: Network Error]

我不知道我在做什么错。

0 个答案:

没有答案