Skip to content

Commit a25088f

Browse files
fix: address code review feedback
1 parent 6ab8ede commit a25088f

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

frontend/src/components/Albums/CreateAlbumDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export const CreateAlbumDialog: React.FC<CreateAlbumDialogProps> = ({
145145
{/* Lock Album Toggle */}
146146
<div className="flex items-center justify-between space-x-2">
147147
<div className="space-y-0.5">
148-
<Label htmlFor="hidden">Lock Album</Label>
148+
<Label htmlFor="locked">Lock Album</Label>
149149
<p className="text-muted-foreground text-sm">
150150
Protect your album with a password
151151
</p>

frontend/src/pages/Album/Album.tsx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ function Albums() {
6767
errorTitle: 'Error',
6868
errorMessage: 'Failed to delete album. Please try again.',
6969
onSuccess: () => {
70-
if (albumToDelete) {
71-
dispatch(removeAlbum(albumToDelete.id));
72-
}
70+
// Close dialog and clear state after successful deletion
71+
setIsDeleteDialogOpen(false);
72+
setAlbumToDelete(null);
7373
},
7474
});
7575

@@ -130,19 +130,18 @@ function Albums() {
130130

131131
const confirmDelete = () => {
132132
if (albumToDelete) {
133-
deleteAlbumMutation.mutate(albumToDelete.id);
134-
setIsDeleteDialogOpen(false);
135-
setAlbumToDelete(null);
133+
const albumId = albumToDelete.id;
134+
dispatch(removeAlbum(albumId));
135+
deleteAlbumMutation.mutate(albumId);
136136
}
137137
};
138138

139139
const handleRefresh = async () => {
140140
dispatch(showLoader('Refreshing albums...'));
141-
try {
142-
await refetch();
143-
dispatch(hideLoader());
144-
} catch (error) {
145-
dispatch(hideLoader());
141+
const result = await refetch();
142+
dispatch(hideLoader());
143+
144+
if (result.isError || result.error) {
146145
dispatch(
147146
showInfoDialog({
148147
title: 'Error',

0 commit comments

Comments
 (0)