fix: Return empty array when user not logged in

This commit is contained in:
Roman Godmaire 2023-11-19 20:22:58 -05:00
parent 96ad8f357e
commit 489a637506

View file

@ -2,7 +2,11 @@ import type { PageServerLoad } from './$types';
export const load: PageServerLoad = async ({ locals: { authReq, database } }) => {
const session = await authReq.validate();
if (!session) return {};
if (!session)
return {
tracks: []
};
const tracks = await database.listTracksWithProducer(session.user.userId);