5cd13227ad
* feat: server changes for album timeline * feat(web): album timeline view * chore: open api * chore: remove archive action * fix: favorite for non-owners
24 lines
574 B
TypeScript
24 lines
574 B
TypeScript
import { AppRoute } from '$lib/constants';
|
|
import { redirect } from '@sveltejs/kit';
|
|
import type { PageServerLoad } from './$types';
|
|
|
|
export const load = (async ({ params, locals: { api, user } }) => {
|
|
if (!user) {
|
|
throw redirect(302, AppRoute.AUTH_LOGIN);
|
|
}
|
|
|
|
try {
|
|
const { data: album } = await api.albumApi.getAlbumInfo({ id: params.albumId, withoutAssets: true });
|
|
|
|
return {
|
|
album,
|
|
user,
|
|
meta: {
|
|
title: album.albumName,
|
|
},
|
|
};
|
|
} catch (e) {
|
|
throw redirect(302, AppRoute.ALBUMS);
|
|
}
|
|
}) satisfies PageServerLoad;
|