This commit is contained in:
masterElmar
2024-03-31 18:43:42 +02:00
parent 44897d629f
commit c2c1b17d2d

View File

@ -86,7 +86,7 @@
// fetch mediaData from http://127.0.0.1:8090/api/collections/media/records/ with GET method // fetch mediaData from http://127.0.0.1:8090/api/collections/media/records/ with GET method
function fetchMediaData() { function fetchMediaData() {
fetch("http://127.0.0.1:8090/api/collections/media/records/", { fetch("/api/collections/media/records/", {
method: "GET", method: "GET",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -118,8 +118,8 @@
<input type="checkbox" id="${media.id}"> <input type="checkbox" id="${media.id}">
</td> </td>
<td> <td>
<a href="http://127.0.0.1:8090/api/files/${media.collectionId}/${media.id}/${media.media}"> <a href="/api/files/${media.collectionId}/${media.id}/${media.media}">
<img src="http://127.0.0.1:8090/api/files/${media.collectionId}/${media.id}/${media.media}?thumb=100x100" alt="Preview" style="width: 100px; height: 100px;"> <img src="/api/files/${media.collectionId}/${media.id}/${media.media}?thumb=100x100" alt="Preview" style="width: 100px; height: 100px;">
</a> </a>
</td> </td>
<td>${media.media}</td> <td>${media.media}</td>
@ -142,7 +142,7 @@
// After successful deletion, update the mediaData array and refresh the media list // After successful deletion, update the mediaData array and refresh the media list
// delete media from http://127.0.0.1:8090/api/collections/media/records/{id} with DELETE method // delete media from http://127.0.0.1:8090/api/collections/media/records/{id} with DELETE method
// check for response 204 and remove media from mediaData array // check for response 204 and remove media from mediaData array
fetch(`http://127.0.0.1:8090/api/collections/media/records/`+ mediaId, { fetch(`/api/collections/media/records/`+ mediaId, {
method: "DELETE", method: "DELETE",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -170,7 +170,7 @@
// find the input with the id of index // find the input with the id of index
let durationInput = Array.from(durationInputs).find(input => input.id === index.toString()); let durationInput = Array.from(durationInputs).find(input => input.id === index.toString());
// PATCH request to update the duration of the media file /api/collections/media/records/:id // PATCH request to update the duration of the media file /api/collections/media/records/:id
fetch(`http://127.0.0.1:8090/api/collections/media/records/`+ index, { fetch(`/api/collections/media/records/`+ index, {
method: "PATCH", method: "PATCH",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",