DEV Community

Discussion on: How to call api within api

Collapse
prosenjit98 profile image
prosenjit98

const getProductInfo = () => {
const prodId = params.id;
console.log("this is proid",prodId)
const apiUrl = /restaurant/${prodId} ;
axios
.get(apiUrl)
.then((res) => {
console.log("api info res", res.data.vendorDataID);
setUser(res.data.vendorDataID);
return axios.get(...); // using response.data
}).then((response) => {
console.log('Response', response);
}).catch((err) => {
console.log("error", err);
});