From 413e0382270e1131fae51c96c275b3b0de29d28e Mon Sep 17 00:00:00 2001 From: Phill Pover Date: Mon, 7 Apr 2025 12:29:56 +0100 Subject: [PATCH] More error message work --- frontend/src/app/album/page.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/album/page.tsx b/frontend/src/app/album/page.tsx index 1d44232..af6eea1 100644 --- a/frontend/src/app/album/page.tsx +++ b/frontend/src/app/album/page.tsx @@ -49,20 +49,20 @@ export default function Page() { await createAlbum(formData) .then(response => { if (response.ok) { - handleSnackbar(`Successfully created Album with ID ${formData.get("id")}: ${response}`, true); + handleSnackbar(`Successfully created Album with ID ${formData.get("id")}: ${response.json()}`, true); } - handleSnackbar(`Failed to create Album with ID ${formData.get("id")}: ${response}`, false); + handleSnackbar(`Failed to create Album with ID ${formData.get("id")}: ${response.json()}`, false); }) - .catch(error => {handleSnackbar(`Failed to create Album with ID ${formData.get("id")}: ${error}`, false);}); + .catch(error => {handleSnackbar(`Failed to create Album with ID ${formData.get("id")}: ${error.json()}`, false);}); } else { await updateAlbum(formData) .then(response => { if (response.ok) { - handleSnackbar(`Successfully updated Album with ID ${formData.get("id")}: ${response}`, true); + handleSnackbar(`Successfully updated Album with ID ${formData.get("id")}: ${response.json()}`, true); } - handleSnackbar(`Failed to update Album with ID ${formData.get("id")}: ${response}`, false); + handleSnackbar(`Failed to update Album with ID ${formData.get("id")}: ${response.json()}`, false); }) - .catch(error => {handleSnackbar(`Failed to update Album with ID ${formData.get("id")}: ${error}`, false);}); + .catch(error => {handleSnackbar(`Failed to update Album with ID ${formData.get("id")}: ${error.json()}`, false);}); } revalidateAlbums(); const data = await getAlbums();