Removing unnecessary checks
All checks were successful
Music Collection CI Workflow / test (./backend) (push) Successful in 38s
Music Collection CI Workflow / test (./frontend) (push) Successful in 40s
Music Collection CI Workflow / build-and-push-images (./backend/Dockerfile, git.anatid.net/tabris/music-collection-backend, ./backend) (push) Successful in 55s
Music Collection CI Workflow / build-and-push-images (./frontend/Dockerfile, git.anatid.net/tabris/music-collection-frontend, ./frontend) (push) Successful in 1m52s
Music Collection CI Workflow / deploy (push) Successful in 24s

This commit is contained in:
Phill Pover 2025-04-07 14:43:24 +01:00
parent 0b93e6904e
commit 634db87b8c
2 changed files with 21 additions and 23 deletions

View File

@ -51,13 +51,13 @@ export default function Page() {
const formData = new FormData(event.currentTarget);
try {
if (formData.get('id') == "") {
await createSong(formData).then(response => {
handleSnackbar(`Successfully created Song with ID ${formData.get("id")}: ${JSON.stringify(response)}`, true);
await createSong(formData).then(() => {
handleSnackbar(`Successfully created Song with ID ${formData.get("id")}`, true);
})
.catch(error => {handleSnackbar(`Failed to create Song with ID ${formData.get("id")}: ${JSON.stringify(error)}`, false);});
} else {
await updateSong(formData).then(response => {
handleSnackbar(`Successfully created Song with ID ${formData.get("id")}: ${JSON.stringify(response)}`, true);
await updateSong(formData).then(() => {
handleSnackbar(`Successfully created Song with ID ${formData.get("id")}`, true);
})
.catch(error => {handleSnackbar(`Failed to create Song with ID ${formData.get("id")}: ${JSON.stringify(error)}`, false);});
}
@ -105,11 +105,10 @@ export default function Page() {
const handleDelete = async (event: MouseEvent<HTMLElement>) => {
const songId = event.currentTarget.getAttribute('song-id');
if (songId) {
try {
await deleteSong(parseInt(songId));
} catch (error) {
handleSnackbar(`Error deleting song with ID ${songId}: ${JSON.stringify(error)}`, false);
}
await deleteSong(parseInt(songId)).then(() => {
handleSnackbar(`Successfully deleted Song with ID ${songId}`, true);
})
.catch(error => {handleSnackbar(`Error deleting song with ID ${songId}: ${JSON.stringify(error)}`, false);});
revalidateAlbum();
const data = await getAlbum(parseInt(albumId));
setAlbum(data);

View File

@ -47,16 +47,16 @@ export default function Page() {
try {
if (formData.get('id') == "") {
await createAlbum(formData)
.then(response => {
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);});
.then(() => {
handleSnackbar(`Successfully created Album with ID ${formData.get("id")}`, true);
})
.catch(error => {handleSnackbar(`Failed to create Album with ID ${formData.get("id")}: ${JSON.stringify(error)}`, false);});
} else {
await updateAlbum(formData)
.then(response => {
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);});
.then(() => {
handleSnackbar(`Successfully updated Album with ID ${formData.get("id")}`, true);
})
.catch(error => {handleSnackbar(`Failed to update Album with ID ${formData.get("id")}: ${JSON.stringify(error)}`, false);});
}
revalidateAlbums();
const data = await getAlbums();
@ -100,12 +100,11 @@ export default function Page() {
const handleDelete = async (event: MouseEvent<HTMLElement>) => {
const id = event.currentTarget.getAttribute('album-id');
if (id) {
try {
await deleteAlbum(parseInt(id));
handleSnackbar(`Successfully deleted Album with ID ${id}`, true);
} catch (error) {
handleSnackbar(`Error deleting Album with ID ${id}: ${JSON.stringify(error)}`, false);
}
await deleteAlbum(parseInt(id))
.then(() => {
handleSnackbar(`Successfully updated Deleted with ID ${id}`, true);
})
.catch(error => {handleSnackbar(`Failed to Delete Album with ID ${id}: ${JSON.stringify(error)}`, false);});
revalidateAlbums();
const data = await getAlbums();
setAlbums(data);