Add user profiles and account setup page

This commit is contained in:
NeilClack
2026-02-03 10:11:00 -06:00
parent 2df81d20e3
commit c34e10159d
19 changed files with 3542 additions and 153 deletions
@@ -0,0 +1,23 @@
import type { PageServerLoad } from './$types';
import { prisma } from '$lib/db';
import { error, redirect } from '@sveltejs/kit';
export const load: PageServerLoad = async ({ locals }) => {
const user = await prisma.user.findUnique({
where: {
id: locals.user?.id
},
include: {
profile: true
}
});
if (user) {
if (!user?.profile) {
throw redirect(403, '/account/setup');
}
return { user };
} else {
throw error(403, 'not authorized');
}
};
@@ -0,0 +1,5 @@
<script lang="ts">
import type {PageProps} from "./$types";
let {data}: PageProps = $props();
$inspect(data);
</script>