btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}
btnSlow.onclick = () => getUserInfo(1);
const getUserInfo = (id) => {
fetch('user')
.then(res => res.json())
.then(user =>
content.innerHTML = 'User info'
)
.then(() => fetch('posts'))
.then(res => res.json())
.then(posts => {
content.innerHTML += `${posts}`
return Promise.all(
posts.map(post =>
fetch('comments')
)
)
})
.then(res => Promise.all(
res.map(r => r.json())
))
.then(comments => {
document.posts.forEach(p => {
p.innerHTML += comments
})
})
.catch(err => console.error(err))
}