Pushing errors back to frontend
All checks were successful
Music Collection CI Workflow / test (./backend) (push) Successful in 34s
Music Collection CI Workflow / test (./frontend) (push) Successful in 39s
Music Collection CI Workflow / build-and-push-images (./backend/Dockerfile, git.anatid.net/tabris/music-collection-backend, ./backend) (push) Successful in 52s
Music Collection CI Workflow / build-and-push-images (./frontend/Dockerfile, git.anatid.net/tabris/music-collection-frontend, ./frontend) (push) Successful in 1m50s
Music Collection CI Workflow / deploy (push) Successful in 23s

This commit is contained in:
Phill Pover 2025-04-07 11:24:55 +01:00
parent 4335aaf85c
commit 2a75863e84

View File

@ -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);
}