diff --git a/frontend/src/app/actions.tsx b/frontend/src/app/actions.tsx index dc4e078..a2d5c2f 100644 --- a/frontend/src/app/actions.tsx +++ b/frontend/src/app/actions.tsx @@ -4,6 +4,7 @@ export async function getAlbums() { return fetch('https://api.anatid.net/album', { method: "GET", headers: { "Content-Type": "application/json" }, + next: { revalidate: 3600 } }).then(response => { if (response.ok) { return response.json(); @@ -18,6 +19,7 @@ export async function getAlbum(id: number) { return fetch(`https://api.anatid.net/album/${id}`, { method: "GET", headers: { "Content-Type": "application/json" }, + next: { revalidate: 3600 } }).then(response => { if (response.ok) { return response.json(); @@ -96,6 +98,7 @@ export async function getSongs() { return fetch("https://api.anatid.net/song/", { method: "GET", headers: { "Content-Type": "application/json" }, + next: { revalidate: 3600 } }).then(response => { if (response.ok) { return response.json(); @@ -110,6 +113,7 @@ export async function getSong(id: number) { return fetch(`https://api.anatid.net/song/${id}`, { method: "GET", headers: { "Content-Type": "application/json" }, + next: { revalidate: 3600 } }).then(response => { if (response.ok) { return response.json(); @@ -150,7 +154,7 @@ export async function updateSong(formData: FormData) { const title = formData.get('title'); const duration = formData.get('duration'); const trackNumber = formData.get('trackNumber'); - return fetch(`https://api.anatid.net/song/${album-id}`, { + return fetch(`https://api.anatid.net/song/${albumId}`, { method: "PUT", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ @@ -159,7 +163,8 @@ export async function updateSong(formData: FormData) { title: title, duration: duration, trackNumber: trackNumber, - }) + }), + next: { revalidate: 3600 } }).then(response => { if (response.ok) { return response.json();