From 7530b2300c3d98a56a480e8c5b58d84ca9ee0d8c Mon Sep 17 00:00:00 2001 From: Phill Pover Date: Mon, 7 Apr 2025 11:48:40 +0100 Subject: [PATCH] Fixing messages --- frontend/src/app/album/page.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/album/page.tsx b/frontend/src/app/album/page.tsx index 05c1924..b315ced 100644 --- a/frontend/src/app/album/page.tsx +++ b/frontend/src/app/album/page.tsx @@ -49,22 +49,20 @@ export default function Page() { const result = await createAlbum(formData) .then(response => { if (response.ok) { - return response + handleSnackbar(`Successfully created Album with ID ${formData.get("id")}: ${result}`, true); } Promise.reject(response); }) - .catch(error => {return error}); - handleSnackbar(`Successfully created Album with ID ${formData.get("id")}: ${result}`, true); + .catch(error => {handleSnackbar(`Failed to create Album with ID ${formData.get("id")}: ${result}`, true);}); } else { const result = await updateAlbum(formData) .then(response => { if (response.ok) { - return response + return handleSnackbar(`Successfully updated Album with ID ${formData.get("id")}: ${result}`, true); } Promise.reject(response); }) - .catch(error => {return error}); - handleSnackbar(`Successfully updated Album with ID ${formData.get("id")}: ${result}`, true); + .catch(error => {handleSnackbar(`Failed to update Album with ID ${formData.get("id")}: ${result}`, false);}); } revalidateAlbums(); const data = await getAlbums();