Skip to content

Instantly share code, notes, and snippets.

@nparsons08 nparsons08/18.js Secret
Created May 28, 2019

Embed
What would you like to do?
// ./src/App.vue
// [...]
translateLanguage () {
const translatedMessage = []
this.messages.forEach( async message => {
try {
const { data, status} =
await axios.post(`${process.env.VUE_APP_SERVER}/translate`, {
targetLanguage: this.language,
text: message.text
})
this.messages.push({...message, text: data.TranslatedText})
} catch (e) {
this.messages.push(message)
}
})
this.messages = translatedMessage
},
// [...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.