fetchAudio function takes a word and sends a post request with that data.

static async fetchAudio(word) {
const requestOptions = {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ "word": word })
};
let url = '/speech/';
// fetch() returns a promise that
// resolves…

Jignesh Kakadiya

Mozillian, Open Source developer. Lives in Germany. http://bitshadow.github.io/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store