Use Axios directly
parent
a2e1595b89
commit
d15845a793
|
@ -10,6 +10,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nuxtjs/axios": "^5.12.2",
|
"@nuxtjs/axios": "^5.12.2",
|
||||||
|
"axios": "^0.21.1",
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
"bootstrap": "^4.5.2",
|
"bootstrap": "^4.5.2",
|
||||||
"bootstrap-vue": "^2.17.3",
|
"bootstrap-vue": "^2.17.3",
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import axios from 'axios'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -409,16 +410,16 @@ export default {
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
async sourceText(newValue) {
|
async sourceText(newValue) {
|
||||||
this.targetText = await this.$axios.$post("/api/get", {
|
this.targetText = (await axios.post("/api/get", {
|
||||||
sourceText: newValue,
|
sourceText: newValue,
|
||||||
selectedLanguage: this.selectedLanguage
|
selectedLanguage: this.selectedLanguage
|
||||||
})
|
})).data
|
||||||
},
|
},
|
||||||
async selectedLanguage(newValue) {
|
async selectedLanguage(newValue) {
|
||||||
this.targetText = await this.$axios.$post("/api/get", {
|
this.targetText = (await axios.post("/api/get", {
|
||||||
sourceText: this.sourceText,
|
sourceText: this.sourceText,
|
||||||
selectedLanguage: newValue
|
selectedLanguage: newValue
|
||||||
})
|
})).data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue