diff --git a/web/src/lib/components/asset-viewer/asset-viewer.svelte b/web/src/lib/components/asset-viewer/asset-viewer.svelte index 2199359432..0703abfe11 100644 --- a/web/src/lib/components/asset-viewer/asset-viewer.svelte +++ b/web/src/lib/components/asset-viewer/asset-viewer.svelte @@ -304,7 +304,7 @@ on:onVideoEnded={() => (shouldPlayMotionPhoto = false)} /> {:else} - + {/if} {:else} diff --git a/web/src/lib/components/asset-viewer/photo-viewer.svelte b/web/src/lib/components/asset-viewer/photo-viewer.svelte index 9a2d2dacf2..13035047e7 100644 --- a/web/src/lib/components/asset-viewer/photo-viewer.svelte +++ b/web/src/lib/components/asset-viewer/photo-viewer.svelte @@ -10,22 +10,14 @@ NotificationType } from '../shared-components/notification/notification'; - export let assetId: string; + export let asset: AssetResponseDto; export let publicSharedKey = ''; - let assetInfo: AssetResponseDto; let assetData: string; let copyImageToClipboard: (src: string) => Promise; onMount(async () => { - const { data } = await api.assetApi.getAssetById(assetId, { - params: { - key: publicSharedKey - } - }); - assetInfo = data; - //Import hack :( see https://github.com/vadimkorr/svelte-carousel/issues/27#issuecomment-851022295 const module = await import('copy-image-clipboard'); copyImageToClipboard = module.copyImageToClipboard; @@ -33,7 +25,7 @@ const loadAssetData = async () => { try { - const { data } = await api.assetApi.serveFile(assetInfo.id, false, true, { + const { data } = await api.assetApi.serveFile(asset.id, false, true, { params: { key: publicSharedKey }, @@ -75,18 +67,15 @@ transition:fade={{ duration: 150 }} class="flex place-items-center place-content-center h-full select-none" > - {#if assetInfo} - {#await loadAssetData()} - - {:then assetData} - {assetId} - {/await} - {/if} + {#await loadAssetData()} + + {:then assetData} + {asset.id} + {/await} diff --git a/web/src/lib/components/asset-viewer/video-viewer.svelte b/web/src/lib/components/asset-viewer/video-viewer.svelte index ba1e580b00..dff3c44ff1 100644 --- a/web/src/lib/components/asset-viewer/video-viewer.svelte +++ b/web/src/lib/components/asset-viewer/video-viewer.svelte @@ -1,40 +1,17 @@