mirror of
https://github.com/olegvodyanov/instalinks.git
synced 2025-12-20 11:27:04 +03:00
Compare commits
No commits in common. "6b7d938d89e7addbacdaea8bd4e7f3a8170e55d7" and "b3b4f7219362292d433bc5110e8a023e0d99c0bb" have entirely different histories.
6b7d938d89
...
b3b4f72193
@ -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