'Axios "TypeError: Cannot read properties of undefined (reading 'then')" on request
I'm trying making a GET request using Axios to my Discord bot, but i'm getting a problem.
var axios = require("axios");
var response;
function getItemPrice(name, time) {
axios.get("https://url.com/api/id=${name}&time=${time}")
}
response = getItemPrice("name", "time");
response.then(function(dataResponse){
console.log(dataResponse.data);
}
).catch(function(error){
if(error){
console.log(error);
}
});
I changed the URL. Show this in console ↓
TypeError: Cannot read properties of undefined (reading 'then')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
