fix(web): layout nesting (#1881)

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
Michel Heusschen
2023-02-27 04:23:43 +01:00
committed by GitHub
parent 2efa8b6960
commit 807bdfeda9
31 changed files with 72 additions and 88 deletions

View File

@@ -0,0 +1,36 @@
export const prerender = false;
import { error } from '@sveltejs/kit';
import { getThumbnailUrl } from '$lib/utils/asset-utils';
import { ThumbnailFormat } from '@api';
import type { PageServerLoad } from './$types';
import featurePanelUrl from '$lib/assets/feature-panel.png';
export const load: PageServerLoad = async ({ params, parent, locals: { api } }) => {
const { user } = await parent();
const { key } = params;
try {
const { data: sharedLink } = await api.shareApi.getMySharedLink(key);
const assetCount = sharedLink.assets.length;
const assetId = sharedLink.album?.albumThumbnailAssetId || sharedLink.assets[0]?.id;
return {
sharedLink,
meta: {
title: sharedLink.album ? sharedLink.album.albumName : 'Public Share',
description: sharedLink.description || `${assetCount} shared photos & videos.`,
imageUrl: assetId
? getThumbnailUrl(assetId, ThumbnailFormat.Webp, sharedLink.key)
: featurePanelUrl
},
user
};
} catch (e) {
throw error(404, {
message: 'Invalid shared link'
});
}
};