Fixing if/elses
Some checks failed
Music Collection CI Workflow / test (./backend) (push) Successful in 37s
Music Collection CI Workflow / test (./frontend) (push) Failing after 37s
Music Collection CI Workflow / deploy (push) Has been skipped
Music Collection CI Workflow / build-and-push-images (./backend/Dockerfile, git.anatid.net/tabris/music-collection-backend, ./backend) (push) Has been skipped
Music Collection CI Workflow / build-and-push-images (./frontend/Dockerfile, git.anatid.net/tabris/music-collection-frontend, ./frontend) (push) Has been skipped

This commit is contained in:
Phill Pover 2025-04-07 14:05:29 +01:00
parent 22c6bea333
commit 3fb2053146
2 changed files with 8 additions and 4 deletions

View File

@ -54,16 +54,18 @@ export default function Page() {
await createSong(formData).then(response => { await createSong(formData).then(response => {
if (response.ok) { if (response.ok) {
handleSnackbar(`Successfully created Song with ID ${formData.get("id")}: ${JSON.stringify(response)}`, true); 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(`Failed to create Song with ID ${formData.get("id")}: ${JSON.stringify(response)}`, false);
}) })
.catch(error => {handleSnackbar(`Failed to create Song with ID ${formData.get("id")}: ${JSON.stringify(error)}`, false);}); .catch(error => {handleSnackbar(`Failed to create Song with ID ${formData.get("id")}: ${JSON.stringify(error)}`, false);});
} else { } else {
await updateSong(formData).then(response => { await updateSong(formData).then(response => {
if (response.ok) { if (response.ok) {
handleSnackbar(`Successfully created Song with ID ${formData.get("id")}: ${JSON.stringify(response)}`, true); 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(`Failed to create Song with ID ${formData.get("id")}: ${JSON.stringify(response)}`, false);
}) })
.catch(error => {handleSnackbar(`Failed to create Song with ID ${formData.get("id")}: ${JSON.stringify(error)}`, false);}); .catch(error => {handleSnackbar(`Failed to create Song with ID ${formData.get("id")}: ${JSON.stringify(error)}`, false);});
} }

View File

@ -50,8 +50,9 @@ export default function Page() {
.then(response => { .then(response => {
if (response.ok) { if (response.ok) {
handleSnackbar(`Successfully created Album with ID ${formData.get("id")}: ${JSON.stringify(response)}`, true); 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(`Failed to create Album with ID ${formData.get("id")}: ${JSON.stringify(response)}`, false);
}) })
.catch(error => {handleSnackbar(`Failed to create Album with ID ${formData.get("id")}: ${JSON.stringify(error)}`, false);}); .catch(error => {handleSnackbar(`Failed to create Album with ID ${formData.get("id")}: ${JSON.stringify(error)}`, false);});
} else { } else {
@ -59,8 +60,9 @@ export default function Page() {
.then(response => { .then(response => {
if (response.ok) { if (response.ok) {
handleSnackbar(`Successfully updated Album with ID ${formData.get("id")}: ${JSON.stringify(response)}`, true); 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(`Failed to update Album with ID ${formData.get("id")}: ${JSON.stringify(response)}`, false);
}) })
.catch(error => {handleSnackbar(`Failed to update Album with ID ${formData.get("id")}: ${JSON.stringify(error)}`, false);}); .catch(error => {handleSnackbar(`Failed to update Album with ID ${formData.get("id")}: ${JSON.stringify(error)}`, false);});
} }