0
I am doing the front of a very silly application just to train,the backend is all done and running right tested several times with insomnia,so now on the front I can’t get the data in the database (Mongodb) always returns me an empty array in the answer.
Aqui vai o script vue
import Maquinas from '../services/maquinas'
export default {
name: "home",
data(){
return {
maquinas:[]
}
}
,
mounted(){
Maquinas.listar().then(resposta => {
console.log(resposta)})
}
}
Here is my service that is calling the bank already with the Baseurl configured
import {http} from './config'
export default{
async listar( ){
const user_id = localStorage.getItem('user')
const resposta = await http.get('/maquinas',
{headers : {user_id}})
console.log(resposta)
}
I’ve tried a lot but always returns the empty date
You can open the page directly in the browser
/maquinas
and view the data?– Sergio
no, la also returns an empty array :( worse than only the date that returns empty the rest comes all ok
– Jaime barbosa acacio neto
"only the date returns empty the rest comes all ok!? can you explain better? However if opening the page in the browser shows nothing the problem is in the server. Put this code...
– Sergio
I’ll pick up here, plus the funny and that in the insomnia comes everything ok
– Jaime barbosa acacio neto
here is the repository on github : https://github.com/JaimeAcacio/Maquinas/tree/master/src
– Jaime barbosa acacio neto