Use Axios directly

main
Kevin López 2021-01-13 00:30:37 -03:00
parent a2e1595b89
commit d15845a793
2 changed files with 6 additions and 4 deletions

View File

@ -10,6 +10,7 @@
},
"dependencies": {
"@nuxtjs/axios": "^5.12.2",
"axios": "^0.21.1",
"body-parser": "^1.19.0",
"bootstrap": "^4.5.2",
"bootstrap-vue": "^2.17.3",

View File

@ -25,6 +25,7 @@
</template>
<script>
import axios from 'axios'
export default {
data() {
return {
@ -409,16 +410,16 @@ export default {
},
watch: {
async sourceText(newValue) {
this.targetText = await this.$axios.$post("/api/get", {
this.targetText = (await axios.post("/api/get", {
sourceText: newValue,
selectedLanguage: this.selectedLanguage
})
})).data
},
async selectedLanguage(newValue) {
this.targetText = await this.$axios.$post("/api/get", {
this.targetText = (await axios.post("/api/get", {
sourceText: this.sourceText,
selectedLanguage: newValue
})
})).data
}
}
}