add: local wishlists stored in local storage for anonymous users
This commit is contained in:
@@ -7,8 +7,14 @@ import { eq, and } from 'drizzle-orm';
|
||||
export const load: PageServerLoad = async (event) => {
|
||||
const session = await event.locals.auth();
|
||||
|
||||
// Allow anonymous users to access dashboard for local wishlists
|
||||
if (!session?.user?.id) {
|
||||
throw redirect(303, '/signin');
|
||||
return {
|
||||
user: null,
|
||||
wishlists: [],
|
||||
savedWishlists: [],
|
||||
isAuthenticated: false
|
||||
};
|
||||
}
|
||||
|
||||
const userWishlists = await db.query.wishlists.findMany({
|
||||
@@ -53,7 +59,8 @@ export const load: PageServerLoad = async (event) => {
|
||||
return {
|
||||
user: session.user,
|
||||
wishlists: userWishlists,
|
||||
savedWishlists: savedWithAccess
|
||||
savedWishlists: savedWithAccess,
|
||||
isAuthenticated: true
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user