de0e218440
* Duplicate photos page and rename to favorites * Implement basic functionality to page * Sort imports * Add missing sharing code * Remove unused import * Fix formatting * Use GalleryViewer and new api endpoint * Merge useFavorites into page * Run prettier * Move favorites in side-bar * Remove favorites when unfavorited * Fix close shared link model * Add favorite count to side-bar * Add add to favorites option * Fix formatting * Add favorite icon to image thumbnails * Change var to let
22 lines
424 B
TypeScript
22 lines
424 B
TypeScript
import type { PageServerLoad } from './$types';
|
|
import { redirect, error } from '@sveltejs/kit';
|
|
|
|
export const load: PageServerLoad = async ({ parent }) => {
|
|
try {
|
|
const { user } = await parent();
|
|
if (!user) {
|
|
throw error(400, 'Not logged in');
|
|
}
|
|
|
|
return {
|
|
user,
|
|
meta: {
|
|
title: 'Favorites'
|
|
}
|
|
};
|
|
} catch (e) {
|
|
console.log('Photo page load error', e);
|
|
throw redirect(302, '/auth/login');
|
|
}
|
|
};
|