add previw

This commit is contained in:
itqop 2025-12-30 18:17:41 +03:00
parent 6106a0e397
commit c014f90773
1 changed files with 3 additions and 5 deletions

View File

@ -38,11 +38,9 @@ export default function MediaCard({ asset, selected, onSelect, onClick }: MediaC
setError(false); setError(false);
// Load media through backend proxy with auth // Load media through backend proxy with auth
const kind = asset.storage_key_thumb ? 'thumb' : 'original'; const kind = asset.storage_key_thumb ? 'thumb' : 'original';
if (asset.type === 'photo' || asset.storage_key_thumb) { const blob = await api.getMediaBlob(asset.id, kind);
const blob = await api.getMediaBlob(asset.id, kind); const url = URL.createObjectURL(blob);
const url = URL.createObjectURL(blob); setThumbnailUrl(url);
setThumbnailUrl(url);
}
} catch (err) { } catch (err) {
console.error('Failed to load thumbnail:', err); console.error('Failed to load thumbnail:', err);
setError(true); setError(true);