diff --git a/src/Components/Profile/Subcomponents/GalleryView.tsx b/src/Components/Profile/Subcomponents/GalleryView.tsx index be2e7830..d167aec0 100644 --- a/src/Components/Profile/Subcomponents/GalleryView.tsx +++ b/src/Components/Profile/Subcomponents/GalleryView.tsx @@ -9,26 +9,25 @@ import type { Item } from '#types/Item' export const GalleryView = ({ item }: { item: Item }) => { const [index, setIndex] = useState(-1) const appState = useAppState() - const images = item.gallery?.map((i, j) => { - return { + const images = + item.gallery?.map((i, j) => ({ src: appState.assetsApi.url + `${i.directus_files_id.id}.jpg`, width: i.directus_files_id.width, height: i.directus_files_id.height, index: j, - } - }) + })) ?? [] - if (!images) throw new Error('GalleryView: images is undefined') + if (images.length > 0) + return ( +