diff --git a/backend/app/routes/albums.py b/backend/app/routes/albums.py index f01d52d9..c7696375 100644 --- a/backend/app/routes/albums.py +++ b/backend/app/routes/albums.py @@ -63,7 +63,7 @@ def delete_existing_album(payload: dict): raise HTTPException( status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(e) ) - + @router.post("/add-multiple-to-album") def add_multiple_images_to_album(payload: dict): @@ -107,7 +107,6 @@ def add_multiple_images_to_album(payload: dict): status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(e) ) - @router.delete("/remove-from-album") def remove_image_from_album(payload: dict): try: diff --git a/frontend/src/components/Album/Album.tsx b/frontend/src/components/Album/Album.tsx index 8278ce62..00aa9439 100644 --- a/frontend/src/components/Album/Album.tsx +++ b/frontend/src/components/Album/Album.tsx @@ -32,7 +32,7 @@ const AlbumsView: React.FC = () => { const transformedAlbums = albums.map((album: Album) => ({ id: album.album_name, title: album.album_name, - coverImage: album.image_paths[0] || '/Pictopy.svg', + coverImage: album.image_paths[0] || `D:/Data/Pictopy/PictoPy/frontend/public/tauri.svg`, imageCount: album.image_paths.length, })); diff --git a/frontend/src/components/Album/ImageSelection.tsx b/frontend/src/components/Album/ImageSelection.tsx index 034a7c4d..1890a1b3 100644 --- a/frontend/src/components/Album/ImageSelection.tsx +++ b/frontend/src/components/Album/ImageSelection.tsx @@ -26,7 +26,7 @@ const ImageSelectionPage: React.FC = ({ useAddMultipleImagesToAlbum(); // Extract the array of image paths - const allImages: string[] = allImagesData?.map((image) => image.path) || []; + const allImages: string[] = allImagesData??[];; useEffect(() => { if (error) { diff --git a/frontend/src/hooks/AlbumService.ts b/frontend/src/hooks/AlbumService.ts index ca2ad6df..ea324e0c 100644 --- a/frontend/src/hooks/AlbumService.ts +++ b/frontend/src/hooks/AlbumService.ts @@ -295,14 +295,14 @@ export function useAddMultipleImages() { return { addMultipleImages, ...result }; } -interface Image { - id: string; - path: string; - // Add other properties as needed -} +// interface Image { +// id: string; +// path: string; +// // Add other properties as needed +// } export function useFetchAllImages() { - const [images, setImages] = useState([]); + const [images, setImages] = useState([]); const [isLoading, setIsLoading] = useState(false); const [error, setError] = useState(null); @@ -321,7 +321,7 @@ export function useFetchAllImages() { } const data = await response.json(); console.log(data); - setImages(data); + setImages(data.images); } catch (err) { setError((err as Error).message); } finally {