Skip to content

Commit

Permalink
Merge pull request #79 from Jibesh10101011/bugfix/add-image-button-al…
Browse files Browse the repository at this point in the history
…bum-creation

Frontend updated , Add Images functionality works perfectly
  • Loading branch information
Pranav0-0Aggarwal authored Nov 25, 2024
2 parents 6bae231 + c6545ae commit dd9d132
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
3 changes: 1 addition & 2 deletions backend/app/routes/albums.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Album/Album.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}));

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Album/ImageSelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const ImageSelectionPage: React.FC<ImageSelectionPageProps> = ({
useAddMultipleImagesToAlbum();

// Extract the array of image paths
const allImages: string[] = allImagesData?.map((image) => image.path) || [];
const allImages: string[] = allImagesData??[];;

useEffect(() => {
if (error) {
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/hooks/AlbumService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Image[]>([]);
const [images, setImages] = useState<string[]>([]);
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState<string | null>(null);

Expand All @@ -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 {
Expand Down

0 comments on commit dd9d132

Please sign in to comment.