Enhance SvelteKit project by adding new API routes for dark mode toggling, updating existing route parameters, and improving type definitions. Refactor component imports and optimize asset handling for better performance and maintainability.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import type { LayoutServerLoad } from "./$types";
|
||||
|
||||
export const load: LayoutServerLoad = async ({ locals }) => {
|
||||
const user = locals.user as (Record<string, unknown> & { id: string; darkmode?: boolean }) | null;
|
||||
return {
|
||||
user: user
|
||||
? {
|
||||
id: user.id,
|
||||
email: user.email,
|
||||
name: user.name,
|
||||
avatar: user.avatar,
|
||||
darkmode: !!user.darkmode,
|
||||
}
|
||||
: null,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user