简体   繁体   中英

How to set fulfillmentText from a value taken from an API call using axios?

I was able to retrieve data using axios but I can't seem to publish it to fulfillmentText of dialogflow

const getData = async () => {
    try {
        return await fetch.get(url)
    } catch (error) {
        console.error(error)
    }
}

const countBreeds = async () => {
    const breeds = await getData();
}

responseJson.fulfillmentText = countBreeds().body;
}

moved

responseJson.fulfillmentText = countBreeds().body;

right after

const breeds = await getData();

and it should be

responseJson.fulfillmentText  = breeds.data.body;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM