Reworking actions
All checks were successful
Music Collection CI Workflow / test (./backend) (push) Successful in 21s
Music Collection CI Workflow / test (./frontend) (push) Successful in 27s
Music Collection CI Workflow / build-and-push-images (./backend/Dockerfile, git.anatid.net/tabris/msuic-collection-backend, ./backend) (push) Successful in 48s
Music Collection CI Workflow / build-and-push-images (./frontend/Dockerfile, git.anatid.net/tabris/music-collection-frontend, ./frontend) (push) Successful in 1m42s
Music Collection CI Workflow / deploy (push) Successful in 23s

This commit is contained in:
Phill Pover 2025-04-06 21:21:06 +01:00
parent 5184d8f641
commit 26a68ecc4a
2 changed files with 9 additions and 11 deletions

View File

@ -1,10 +1,7 @@
'use server' 'use server'
export async function getAlbums() { export async function getAlbums() {
return await fetch("https://api.anatid.net/album", { return await fetch('https://api.anatid.net/album');
method: "GET",
headers: { "Content-Type": "application/json" },
});
} }
export async function getAlbum(id: number) { export async function getAlbum(id: number) {
@ -58,10 +55,7 @@ export async function deleteAlbum(formData: FormData) {
} }
export async function getSongs() { export async function getSongs() {
return await fetch(`https://api.anatid.net/song/`, { return await fetch("https://api.anatid.net/song/");
method: "GET",
headers: { "Content-Type": "application/json" },
});
} }
export async function getSong(id: number) { export async function getSong(id: number) {

View File

@ -20,9 +20,13 @@ export default function Page() {
useEffect(() => { useEffect(() => {
async function fetchAlbum(id: string) { async function fetchAlbum(id: string) {
try {
const response = await getAlbum(parseInt(id)); const response = await getAlbum(parseInt(id));
const data = await response.json(); const data = await response.json();
setAlbum(data); setAlbum(data);
} catch (error) {
console.error(`Error getting album with id ${id}`, error);
}
} }
fetchAlbum(id); fetchAlbum(id);
}, [id]); }, [id]);