diff --git a/frontend/src/app/album/[id]/page.tsx b/frontend/src/app/album/[id]/page.tsx index 68e7c36..7b8ed9e 100644 --- a/frontend/src/app/album/[id]/page.tsx +++ b/frontend/src/app/album/[id]/page.tsx @@ -51,8 +51,12 @@ export default function Page() { const formData = new FormData(event.currentTarget); try { if (formData.get('id') == "") { - await createSong(formData).then(() => { - handleSnackbar(`Successfully created Song with ID ${formData.get("id")}`, true); + await createSong(formData).then((response) => { + if (response.messages) { + handleSnackbar(`Failed to create Song with ID ${formData.get("id")}: ${JSON.stringify(response)}`, false); + } else { + handleSnackbar(`Successfully created Song with ID ${formData.get("id")}`, true); + } }) .catch(error => {handleSnackbar(`Failed to create Song with ID ${formData.get("id")}: ${JSON.stringify(error)}`, false);}); } else { diff --git a/frontend/src/app/album/page.tsx b/frontend/src/app/album/page.tsx index 50eefc8..c9a0b60 100644 --- a/frontend/src/app/album/page.tsx +++ b/frontend/src/app/album/page.tsx @@ -47,8 +47,12 @@ export default function Page() { try { if (formData.get('id') == "") { await createAlbum(formData) - .then(() => { - handleSnackbar(`Successfully created Album with ID ${formData.get("id")}`, true); + .then((response) => { + if (response.messages) { + handleSnackbar(`Failed to create Album with ID ${formData.get("id")}: ${JSON.stringify(response)}`, false); + } else { + handleSnackbar(`Successfully created Album with ID ${formData.get("id")}`, true); + } }) .catch(error => {handleSnackbar(`Failed to create Album with ID ${formData.get("id")}: ${JSON.stringify(error)}`, false);}); } else {