mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 20:31:14 -05:00
feat: Enable TypeScript strict mode
This commit is contained in:
@@ -93,15 +93,21 @@ export function ItemEditDialog({ item, items, open, onOpenChange, onComplete }:
|
||||
};
|
||||
|
||||
const handlePhotoSubmit = async (caption: string, credit: string) => {
|
||||
const itemData = typeof item.item_data === 'object' && item.item_data !== null && !Array.isArray(item.item_data)
|
||||
? item.item_data as Record<string, unknown>
|
||||
: {};
|
||||
|
||||
const photos = 'photos' in itemData && Array.isArray(itemData.photos)
|
||||
? itemData.photos
|
||||
: [];
|
||||
|
||||
const photoData = {
|
||||
...item.item_data,
|
||||
photos: Array.isArray(item.item_data.photos)
|
||||
? item.item_data.photos.map((photo: unknown) => ({
|
||||
...(typeof photo === 'object' && photo !== null ? photo : {}),
|
||||
caption,
|
||||
credit,
|
||||
}))
|
||||
: [],
|
||||
...itemData,
|
||||
photos: photos.map((photo: unknown) => ({
|
||||
...(typeof photo === 'object' && photo !== null ? photo as Record<string, unknown> : {}),
|
||||
caption,
|
||||
credit,
|
||||
})),
|
||||
};
|
||||
await handleSubmit(photoData);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user