fix: missing theme on local wishlists in dashboard page

This commit is contained in:
rasmusq
2025-11-28 13:03:13 +01:00
parent eb7ccdf7a2
commit d165e5992a
4 changed files with 115 additions and 19 deletions
@@ -0,0 +1,38 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
import { db } from '$lib/server/db';
import { wishlists } from '$lib/server/schema';
import { eq, or } from 'drizzle-orm';
export const GET: RequestHandler = async ({ params }) => {
const { token } = params;
// Find wishlist by either ownerToken or publicToken
const wishlist = await db.query.wishlists.findFirst({
where: or(
eq(wishlists.ownerToken, token),
eq(wishlists.publicToken, token)
),
with: {
items: {
orderBy: (items, { asc }) => [asc(items.order)]
}
}
});
if (!wishlist) {
return json({ error: 'Wishlist not found' }, { status: 404 });
}
// Return only the necessary fields
return json({
id: wishlist.id,
title: wishlist.title,
ownerToken: wishlist.ownerToken,
publicToken: wishlist.publicToken,
createdAt: wishlist.createdAt,
theme: wishlist.theme,
color: wishlist.color,
items: wishlist.items || []
});
};
+1 -1
View File
@@ -58,7 +58,7 @@
});
</script>
<PageContainer theme={currentTheme} themeColor="#3b82f6">
<PageContainer theme={currentTheme} themeColor={null}>
<DashboardHeader
userName={data.user?.name}
userEmail={data.user?.email}