I’m not familiar with using axios … but this is from the NPM page:
// Want to use async/await? Add the `async` keyword to your outer function/method.
async function getUser() {
try {
const response = await axios.get('/user?ID=12345');
console.log(response);
} catch (error) {
console.error(error);
}
}
I’m not sure your project or requirements but I recently did a simple app with Google API (sheets) to read data. I used Node Fetch to save the data to State, once componentDidMount.
… edit (i could be way off here since I still need more practice with Promises) but since this is being exported, should the expecting function be async as-well and expecting Resolve/Reject (not return?)
I tried same host, path and query params using python requests and my own API key for this api. It is working fine.
The axios cannot resolve error could be setup issue.