Read/unread a directory with API

This commit is contained in:
Alex Ling
2020-04-19 15:47:36 +00:00
parent b449d906ec
commit ec6a7bd3d9
3 changed files with 38 additions and 7 deletions

View File

@@ -38,8 +38,12 @@ function showModal(encodedPath, pages, percentage, encodedeTitle, encodedEntryTi
styleModal();
}
function updateProgress(titleID, entryID, page) {
$.post('/api/progress/' + titleID + '/' + entryID + '/' + page, function(data) {
const updateProgress = (tid, eid, page) => {
let url = `/api/progress/${tid}/${page}`
const query = $.param({entry: eid});
if (eid)
url += `?${query}`;
$.post(url, (data) => {
if (data.success) {
location.reload();
}
@@ -48,7 +52,7 @@ function updateProgress(titleID, entryID, page) {
alert('danger', error);
}
});
}
};
const renameSubmit = (name, eid) => {
const upload = $('.upload-field');