My project is a Vue.js project. I used Flask for api. When i try axios.get request, my api returned objec Objet. Actually when i try same request in Postman, it's work. It returns data.
My code is here:
<script>
import axios from 'axios'
const URL = 'http://localhost:8080/'
mounted(){
axios.get(URL "/KPI/get_category/1").then(response=>{
for (const data in response.data) {
this.kalite.push(JSON.parse(JSON.stringify(response.data[data])))
}
for(const data in this.kalite){
axios.get(URL "/KPI/get_last_input/" this.kalite[data]
['id']).then(response=>{
console.log("response " response)
})
}
})
}
</script>
I see in console like this: response [object Object]
CodePudding user response:
Try with console.log(response.data)
CodePudding user response:
With Axios you should be able to get JSON by reponse.data
.
If using fetch, await response.json()
should do the trick.
You should get familiar with the Network-tab in Devtools, here you can inspect the response, and get an understanding of the data. Specifically Inspect a resource's details