Daisy UI #14

Merged
BenjaminPalko merged 28 commits from daisy-ui into master 2024-12-19 21:20:21 -05:00
2 changed files with 12 additions and 14 deletions
Showing only changes of commit 38021f0453 - Show all commits

View file

@ -1,17 +1,17 @@
import { prisma } from '$lib/server/prisma';
import { redirect } from '@sveltejs/kit';
export async function load(event) {
const userId = event.cookies.get('user');
if (!userId) {
return {
authenticated: false,
};
const sessionId = event.cookies.get('auth_session');
if (!sessionId) {
redirect(303, '/login');
}
const user = await prisma.user.findUnique({
const user = await prisma.session.findUnique({
where: {
id: userId,
id: sessionId,
},
});
return {
authenticated: !!user,
};
if (!user) {
redirect(401, '/login');
}
return {};
}

View file

@ -3,10 +3,8 @@
import Loader from '$lib/components/common/Loader';
import { fade } from 'svelte/transition';
let { data } = $props();
$effect(() => {
const id = setTimeout(() => (data.authenticated ? goto('/app') : goto('/login')), 1500);
const id = setTimeout(() => goto('/app'), 1500);
return () => {
clearTimeout(id);
};
@ -21,4 +19,4 @@
.site-loader {
@apply flex h-screen w-screen flex-col items-center justify-center gap-6;
}
</style>
</style>