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); const formData = new FormData(event.currentTarget);
try { try {
if (formData.get('id') == "") { if (formData.get('id') == "") {
await createSong(formData).then(response => { await createSong(formData).then(() => {
handleSnackbar(`Successfully created Song with ID ${formData.get("id")}: ${JSON.stringify(response)}`, true); 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);}); .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(() => {
handleSnackbar(`Successfully created Song with ID ${formData.get("id")}: ${JSON.stringify(response)}`, true); 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);}); .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 handleDelete = async (event: MouseEvent<HTMLElement>) => {
const songId = event.currentTarget.getAttribute('song-id'); const songId = event.currentTarget.getAttribute('song-id');
if (songId) { if (songId) {
try { await deleteSong(parseInt(songId)).then(() => {
await deleteSong(parseInt(songId)); handleSnackbar(`Successfully deleted Song with ID ${songId}`, true);
} catch (error) { })
handleSnackbar(`Error deleting song with ID ${songId}: ${JSON.stringify(error)}`, false); .catch(error => {handleSnackbar(`Error deleting song with ID ${songId}: ${JSON.stringify(error)}`, false);});
}
revalidateAlbum(); revalidateAlbum();
const data = await getAlbum(parseInt(albumId)); const data = await getAlbum(parseInt(albumId));
setAlbum(data); setAlbum(data);

View File

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