mirror of
https://github.com/Art051/immich.git
synced 2025-08-11 19:29:00 +00:00
27 lines
529 B
TypeScript
27 lines
529 B
TypeScript
import { redirect } from '@sveltejs/kit';
|
|
export const prerender = false;
|
|
|
|
import { api } from '@api';
|
|
import type { PageServerLoad } from './$types';
|
|
|
|
export const load: PageServerLoad = async ({ parent }) => {
|
|
try {
|
|
const { user } = await parent();
|
|
if (!user) {
|
|
throw redirect(302, '/auth/login');
|
|
}
|
|
|
|
const { data: sharedAlbums } = await api.albumApi.getAllAlbums(true);
|
|
|
|
return {
|
|
user: user,
|
|
sharedAlbums,
|
|
meta: {
|
|
title: 'Albums'
|
|
}
|
|
};
|
|
} catch (e) {
|
|
throw redirect(302, '/auth/login');
|
|
}
|
|
};
|