From 0b93e6904e9ce2a05822c27bd44808560e87ac05 Mon Sep 17 00:00:00 2001 From: Phill Pover Date: Mon, 7 Apr 2025 14:29:06 +0100 Subject: [PATCH] Removing unnecessary check --- frontend/src/app/album/[id]/page.tsx | 12 ++---------- frontend/src/app/album/page.tsx | 12 ++---------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/frontend/src/app/album/[id]/page.tsx b/frontend/src/app/album/[id]/page.tsx index ea0db4f..f77f583 100644 --- a/frontend/src/app/album/[id]/page.tsx +++ b/frontend/src/app/album/[id]/page.tsx @@ -52,20 +52,12 @@ export default function Page() { try { if (formData.get('id') == "") { await createSong(formData).then(response => { - if (response.ok) { - handleSnackbar(`Successfully created Song with ID ${formData.get("id")}: ${JSON.stringify(response)}`, true); - } else { - handleSnackbar(`Failed to create Song with ID ${formData.get("id")}: ${JSON.stringify(response)}`, false); - } + handleSnackbar(`Successfully created Song with ID ${formData.get("id")}: ${JSON.stringify(response)}`, true); }) .catch(error => {handleSnackbar(`Failed to create Song with ID ${formData.get("id")}: ${JSON.stringify(error)}`, false);}); } else { await updateSong(formData).then(response => { - if (response.ok) { - handleSnackbar(`Successfully created Song with ID ${formData.get("id")}: ${JSON.stringify(response)}`, true); - } else { - handleSnackbar(`Failed to create Song with ID ${formData.get("id")}: ${JSON.stringify(response)}`, false); - } + handleSnackbar(`Successfully created Song with ID ${formData.get("id")}: ${JSON.stringify(response)}`, true); }) .catch(error => {handleSnackbar(`Failed to create Song with ID ${formData.get("id")}: ${JSON.stringify(error)}`, false);}); } diff --git a/frontend/src/app/album/page.tsx b/frontend/src/app/album/page.tsx index 2c52a72..60ae4b5 100644 --- a/frontend/src/app/album/page.tsx +++ b/frontend/src/app/album/page.tsx @@ -48,21 +48,13 @@ export default function Page() { if (formData.get('id') == "") { await createAlbum(formData) .then(response => { - if (response.ok) { - handleSnackbar(`Successfully created Album with ID ${formData.get("id")}: ${JSON.stringify(response)}`, true); - } else { - handleSnackbar(`Failed to create Album with ID ${formData.get("id")}: ${JSON.stringify(response)}`, false); - } + handleSnackbar(`Successfully created Album with ID ${formData.get("id")}: ${JSON.stringify(response)}`, true); }) .catch(error => {handleSnackbar(`Failed to create Album with ID ${formData.get("id")}: ${JSON.stringify(error)}`, false);}); } else { await updateAlbum(formData) .then(response => { - if (response.ok) { - handleSnackbar(`Successfully updated Album with ID ${formData.get("id")}: ${JSON.stringify(response)}`, true); - } else { - handleSnackbar(`Failed to update Album with ID ${formData.get("id")}: ${JSON.stringify(response)}`, false); - } + handleSnackbar(`Successfully updated Album with ID ${formData.get("id")}: ${JSON.stringify(response)}`, true); }) .catch(error => {handleSnackbar(`Failed to update Album with ID ${formData.get("id")}: ${JSON.stringify(error)}`, false);}); }