e9fda40b2b
* Create shared link modal for individual asset * Added API to create asset shared link * Added viewer for individual shared link * Added multiselection app bar * Refactor gallery viewer to its own component * Refactor * Refactor * Add and remove asset from shared link * Fixed test * Fixed notification card doesn't wrap * Add check asset access when created asset shared link * pr feedback
36 lines
1012 B
TypeScript
36 lines
1012 B
TypeScript
export const prerender = false;
|
|
import { error } from '@sveltejs/kit';
|
|
|
|
import { getThumbnailUrl } from '$lib/utils/asset-utils';
|
|
import { serverApi, ThumbnailFormat } from '@api';
|
|
import type { PageServerLoad } from './$types';
|
|
|
|
export const load: PageServerLoad = async ({ params, parent }) => {
|
|
const { user } = await parent();
|
|
|
|
const { key } = params;
|
|
|
|
try {
|
|
const { data: sharedLink } = await serverApi.shareApi.getMySharedLink({ params: { 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)
|
|
: 'feature-panel.png'
|
|
},
|
|
user
|
|
};
|
|
} catch (e) {
|
|
throw error(404, {
|
|
message: 'Invalid shared link'
|
|
});
|
|
}
|
|
};
|