mirror of
https://github.com/olegvodyanov/instalinks.git
synced 2025-12-20 11:27:04 +03:00
Compare commits
No commits in common. "fd5929f735e802f342c59fda650f199a2ee511e2" and "37ab5965ed3e43b5019e437ece505deab3b02ddd" have entirely different histories.
fd5929f735
...
37ab5965ed
@ -3,10 +3,9 @@ const addLinkBtn = document.getElementById('addLinkBtn');
|
||||
const newLinksContainer = document.getElementById('newLinksContainer');
|
||||
const watchedLinksContainer = document.getElementById('watchedLinksContainer');
|
||||
|
||||
const PER_PAGE = 8;
|
||||
let currentPage = 1;
|
||||
|
||||
function loadLinks() {
|
||||
const PER_PAGE = 8;
|
||||
let currentPage = 1;
|
||||
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));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user