Compare commits

..

No commits in common. "fd5929f735e802f342c59fda650f199a2ee511e2" and "37ab5965ed3e43b5019e437ece505deab3b02ddd" have entirely different histories.

View File

@ -3,10 +3,9 @@ const addLinkBtn = document.getElementById('addLinkBtn');
const newLinksContainer = document.getElementById('newLinksContainer');
const watchedLinksContainer = document.getElementById('watchedLinksContainer');
function loadLinks() {
const PER_PAGE = 8;
let currentPage = 1;
function loadLinks() {
fetch(`/api/links/?page=${currentPage}&per_page=${PER_PAGE}`)
.then(res => res.json())
.then(data => {
@ -108,7 +107,7 @@ function deleteLink(linkId) {
if (res.ok) {
linksData = linksData.filter(link => link.id !== linkId);
currentPage = 1;
loadLinks();
renderPaginatedList();
reinitializeInstagramEmbeds();
}
})
@ -134,7 +133,7 @@ function markLinkWatched(linkId) {
if (idx !== -1) {
linksData[idx] = updatedLink;
}
loadLinks();
renderPaginatedList();
reinitializeInstagramEmbeds();
})
.catch(err => console.error(err));
@ -156,7 +155,7 @@ addLinkBtn.addEventListener('click', () => {
linksData.push(addedLink);
newLinkInput.value = '';
currentPage = 1;
loadLinks();
renderPaginatedList();
reinitializeInstagramEmbeds();
})
.catch(err => console.error(err));