【问题标题】:Post the following data using axios with help of picture借助图片使用axios发布以下数据
【发布时间】:2021-02-28 07:34:45
【问题描述】:

借助这张图片,我希望使用 axios post 构建一个 api 调用。当我尝试获取数据时,尽管 api 正在访问后端,但我遇到了错误。

这是我的代码:

login = async() => {
let params = {
      email: "abc@gmail.com",
      password: "12342346667"
    }

let res0 = await axios.post('https://example.com/authentication/api/Login', params)
      .catch((error) => console.log('error', error));
}

邮递员邮寄方式:

我是 React 新手。

【问题讨论】:

    标签: reactjs react-native post axios postman


    【解决方案1】:

    试试这个方法

    axios.post('https://example.com/authentication/api/Login', {
        email: "abc@gmail.com",
        password: "12342346667"
      })
      .then(function response) {
        console.log(response);
      })
      .catch(function (error) {
        console.log(error);
      });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-06
      • 2017-09-14
      • 2020-09-01
      • 2019-04-12
      • 2018-07-18
      • 2023-03-15
      • 2018-12-25
      • 2020-05-18
      相关资源
      最近更新 更多