Returning data from Axios API

前端 未结 8 1344
伪装坚强ぢ
伪装坚强ぢ 2020-12-07 11:52

I am trying to use a Node.JS application to make and receive API requests. It does a get request to another server using Axios with data it receives from an API call it rece

8条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-07 12:47

        async handleResponse(){
          const result = await this.axiosTest();
        }
    
        async axiosTest () {
        return await axios.get(url)
        .then(function (response) {
                console.log(response.data);
                return response.data;})
    .catch(function (error) {
        console.log(error);
    });
    }
    

    You can find check https://flaviocopes.com/axios/#post-requests url and find some relevant information in the GET section of this post.

提交回复
热议问题