mirror of
https://github.com/olegvodyanov/instalinks.git
synced 2025-12-20 09:07:04 +03:00
Compare commits
4 Commits
b3b4f72193
...
6b7d938d89
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b7d938d89 | ||
|
|
fd5929f735 | ||
|
|
7347beda9e | ||
|
|
1b57db3fb1 |
@ -3,9 +3,10 @@ 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 => {
|
||||
@ -107,7 +108,7 @@ function deleteLink(linkId) {
|
||||
if (res.ok) {
|
||||
linksData = linksData.filter(link => link.id !== linkId);
|
||||
currentPage = 1;
|
||||
renderPaginatedList();
|
||||
loadLinks();
|
||||
reinitializeInstagramEmbeds();
|
||||
}
|
||||
})
|
||||
@ -133,7 +134,7 @@ function markLinkWatched(linkId) {
|
||||
if (idx !== -1) {
|
||||
linksData[idx] = updatedLink;
|
||||
}
|
||||
renderPaginatedList();
|
||||
loadLinks();
|
||||
reinitializeInstagramEmbeds();
|
||||
})
|
||||
.catch(err => console.error(err));
|
||||
@ -155,7 +156,7 @@ addLinkBtn.addEventListener('click', () => {
|
||||
linksData.push(addedLink);
|
||||
newLinkInput.value = '';
|
||||
currentPage = 1;
|
||||
renderPaginatedList();
|
||||
loadLinks();
|
||||
reinitializeInstagramEmbeds();
|
||||
})
|
||||
.catch(err => console.error(err));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user