mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-04 03:27:09 -05:00 
			
		
		
		
	fix(web): use id instead of assetId (#2643)
This commit is contained in:
		
							parent
							
								
									a9fb1d435a
								
							
						
					
					
						commit
						47673dd773
					
				@ -57,7 +57,7 @@ function createAssetInteractionStore() {
 | 
				
			|||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const setViewingAssetId = async (id: string) => {
 | 
						const setViewingAssetId = async (id: string) => {
 | 
				
			||||||
		const { data } = await api.assetApi.getAssetById({ assetId: id });
 | 
							const { data } = await api.assetApi.getAssetById({ id });
 | 
				
			||||||
		viewingAssetStoreState.set(data);
 | 
							viewingAssetStoreState.set(data);
 | 
				
			||||||
		isViewingAssetStoreState.set(true);
 | 
							isViewingAssetStoreState.set(true);
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
				
			|||||||
@ -1,18 +1,19 @@
 | 
				
			|||||||
export const prerender = false;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import { error } from '@sveltejs/kit';
 | 
					import { error } from '@sveltejs/kit';
 | 
				
			||||||
import type { PageServerLoad } from './$types';
 | 
					import type { PageServerLoad } from './$types';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const load = (async ({ params, locals: { api } }) => {
 | 
					export const load = (async ({ params, locals: { api } }) => {
 | 
				
			||||||
	try {
 | 
					 | 
				
			||||||
	const { key, assetId } = params;
 | 
						const { key, assetId } = params;
 | 
				
			||||||
		const { data: asset } = await api.assetApi.getAssetById({ assetId, key });
 | 
						const { data: asset } = await api.assetApi.getAssetById({ id: assetId, key });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!asset) {
 | 
						if (!asset) {
 | 
				
			||||||
			return error(404, 'Asset not found');
 | 
							throw error(404, 'Asset not found');
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
		return { asset, key };
 | 
					
 | 
				
			||||||
	} catch (e) {
 | 
						return {
 | 
				
			||||||
		console.log('Error', e);
 | 
							asset,
 | 
				
			||||||
 | 
							key,
 | 
				
			||||||
 | 
							meta: {
 | 
				
			||||||
 | 
								title: 'Public Share'
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
}) satisfies PageServerLoad;
 | 
					}) satisfies PageServerLoad;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user