TomWalbridge,
вариант для медитации
async function createPostsNav() {
const pagination = await getPostsData();
const postsNav = document.querySelector('.nav__list');
let postNav = '';
for (let i = 1; i <= pagination.pagination.pages; i++) {
postNav += `
<option value="index.html?page=${i}"> Page ${i}
</option>
`;
postsNav.innerHTML = postNav;
}
const paginationNav = document.querySelector('.pagination');
paginationNav.addEventListener( "click" , function(event) {
let btn = event.target.closest('.btn-pagination');
if(btn) {
event.preventDefault();
let i = postsNav.selectedIndex;
let up = btn.classList.contains('pagination-prev') ? -1 : 1;
let len = postsNav.options.length - 1;
let k = i + up;
k = Math.max(0, Math.min(k , len));
if(k !== i) {
postsNav.selectedIndex = k;
// k++
//createPostsList(page=k)
}
}
});
}