how to return response of axios in return

前端 未结 4 1825
长情又很酷
长情又很酷 2021-02-01 06:09

I want to return the response of axios but always the response that returned is undefined:

wallet.registerUser=function(data){
axios.post(\'http://localhost:8080         


        
4条回答
  •  醉酒成梦
    2021-02-01 06:50

    The main point here is to access the promise value. For that, we just need to log the response in the below format.

    static getSearchAPI = () => {
    return axios.post(URl);
    }
    
    getRestaurents() {
    Helpers.getSearchAPI().then(function (response) {
      console.log(response.data);
    })}
    

提交回复
热议问题