|
@@ -1,18 +1,19 @@
|
|
|
-export const prerender = false;
|
|
|
-
|
|
|
import { error } from '@sveltejs/kit';
|
|
|
import type { PageServerLoad } from './$types';
|
|
|
|
|
|
export const load = (async ({ params, locals: { api } }) => {
|
|
|
- try {
|
|
|
- const { key, assetId } = params;
|
|
|
- const { data: asset } = await api.assetApi.getAssetById({ assetId, key });
|
|
|
+ const { key, assetId } = params;
|
|
|
+ const { data: asset } = await api.assetApi.getAssetById({ id: assetId, key });
|
|
|
|
|
|
- if (!asset) {
|
|
|
- return error(404, 'Asset not found');
|
|
|
- }
|
|
|
- return { asset, key };
|
|
|
- } catch (e) {
|
|
|
- console.log('Error', e);
|
|
|
+ if (!asset) {
|
|
|
+ throw error(404, 'Asset not found');
|
|
|
}
|
|
|
+
|
|
|
+ return {
|
|
|
+ asset,
|
|
|
+ key,
|
|
|
+ meta: {
|
|
|
+ title: 'Public Share'
|
|
|
+ }
|
|
|
+ };
|
|
|
}) satisfies PageServerLoad;
|