account page
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import type { PageServerLoad } from '$types';
|
||||
import sql from '$lib/db/db.server';
|
||||
import type { User } from '$lib/types/user';
|
||||
|
||||
export const load: PageServerLoad = async ({ locals }) => {
|
||||
if (!locals || !locals.user) {
|
||||
throw Error('Need to be logged in!');
|
||||
}
|
||||
|
||||
const [userData]: User[] = await sql`
|
||||
SELECT * FROM users WHERE id = ${locals.user.id}
|
||||
`;
|
||||
|
||||
console.log(userData);
|
||||
|
||||
return { userData };
|
||||
};
|
||||
Reference in New Issue
Block a user