const liWrapper = function(val){
return `
${val}`
}
const queryArticles = `
query Articles{
articles{
id
title
category {
id
name
}
body
createdAt
}
}
`
fetch('https://jbl-backend-development-api.herokuapp.com/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: JSON.stringify({query: queryArticles})
})
.then(r => r.json())
.then(data => {
asdf = data.data.articles.map(a => {
return liWrapper(a.title)
}).join("")
document.getElementById("articles").innerHTML = asdf
});