diff --git a/frontend/src/app/album/page.tsx b/frontend/src/app/album/page.tsx index a0d15cf..4883cf7 100644 --- a/frontend/src/app/album/page.tsx +++ b/frontend/src/app/album/page.tsx @@ -47,12 +47,22 @@ export default function Page() { try { if (formData.get('id') == "") { const result = createAlbum(formData) - .then(response => {return response.json()}) + .then(response => { + if (response.ok) { + return response.json() + } + Promise.reject(response); + }) .catch(error => {return error.json()}); handleSnackbar(`Successfully updated Album with ID ${formData.get("id")}: ${result}`, true); } else { const result = updateAlbum(formData) - .then(response => {return response.json()}) + .then(response => { + if (response.ok) { + return response.json() + } + Promise.reject(response); + }) .catch(error => {return error.json()}); handleSnackbar(`Successfully updated Album with ID ${formData.get("id")}: ${result}`, true); }