fix: missing theme on local wishlists in dashboard page
This commit is contained in:
@@ -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 || []
|
||||
});
|
||||
};
|
||||
@@ -58,7 +58,7 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<PageContainer theme={currentTheme} themeColor="#3b82f6">
|
||||
<PageContainer theme={currentTheme} themeColor={null}>
|
||||
<DashboardHeader
|
||||
userName={data.user?.name}
|
||||
userEmail={data.user?.email}
|
||||
|
||||
Reference in New Issue
Block a user