Skip to content

Commit ed787cc

Browse files
authored
Merge pull request #54 from AdamVacha/prod-update2
Prod update2
2 parents 9e4b9a6 + e6dc4e7 commit ed787cc

2 files changed

Lines changed: 45 additions & 18 deletions

File tree

src/routes/login/+page.server.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { redirect } from '@sveltejs/kit';
2+
import type { PageServerLoad } from './$types';
3+
4+
export const load: PageServerLoad = async ({ locals }) => {
5+
const session = await locals.auth();
6+
7+
if (session?.user) {
8+
redirect(308, '/dashboard');
9+
}
10+
11+
return {
12+
session: null
13+
};
14+
};

src/routes/login/+page.svelte

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,55 @@
22
import { signIn } from '@auth/sveltekit/client';
33
import { SignIn } from '@auth/sveltekit/components';
44
import { page } from '$app/state';
5-
import { goto } from '$app/navigation';
65
import { DotLottieSvelte } from '@lottiefiles/dotlottie-svelte';
7-
8-
console.log(page.data.session);
9-
10-
if (page.data.session) {
11-
goto('/dashboard');
12-
}
136
</script>
147

158
<div
16-
class="flex min-h-screen items-center justify-center bg-gradient-to-b from-surface-100 to-tertiary-100 dark:from-surface-700 dark:to-surface-900 px-4 py-6 sm:px-6 sm:py-8"
9+
class="flex min-h-screen items-center justify-center bg-gradient-to-b from-surface-100 to-tertiary-100 px-4 py-6 sm:px-6 sm:py-8 dark:from-surface-700 dark:to-surface-900"
1710
>
18-
<div class="card w-full max-w-xs sm:max-w-sm md:max-w-md lg:max-w-lg p-4 sm:p-6 md:p-8 lg:p-10 shadow-lg">
11+
<div
12+
class="card w-full max-w-xs p-4 shadow-lg sm:max-w-sm sm:p-6 md:max-w-md md:p-8 lg:max-w-lg lg:p-10"
13+
>
1914
<!-- Welcome and Animation -->
20-
<header class="card-header mb-4 sm:mb-6 text-center">
21-
<h1 class="text-xl sm:text-2xl font-bold">Welcome to Hungry Stack</h1>
22-
<div class="w-full max-w-64 mx-auto">
15+
<header class="card-header mb-4 text-center sm:mb-6">
16+
<h1 class="text-xl font-bold sm:text-2xl">Welcome to Hungry Stack</h1>
17+
<div class="mx-auto w-full max-w-64">
2318
<DotLottieSvelte src="/animations/pancakes.lottie" loop={true} autoplay={true} />
2419
</div>
2520
<p class="text-sm sm:text-base">Sign in or sign up to continue learning!</p>
2621
</header>
2722

28-
<section class="space-y-3 sm:space-y-4 text-center">
23+
<section class="space-y-3 text-center sm:space-y-4">
2924
<!-- Google Authentication - Using the SignIn component -->
3025
<SignIn provider="google" callbackUrl="/dashboard">
31-
<div slot="submitButton" class="btn flex justify-center items-center w-full bg-red-500 py-2 sm:py-3 text-white text-sm sm:text-base">
32-
<span><img src="/images/google.svg" alt="Google" class="mr-2 sm:mr-3 h-5 w-5 sm:h-6 sm:w-6" /></span>
26+
<div
27+
slot="submitButton"
28+
class="btn flex w-full items-center justify-center bg-red-500 py-2 text-sm text-white sm:py-3 sm:text-base"
29+
>
30+
<span
31+
><img
32+
src="/images/google.svg"
33+
alt="Google"
34+
class="mr-2 h-5 w-5 sm:mr-3 sm:h-6 sm:w-6"
35+
/></span
36+
>
3337
<span>Continue with Google</span>
3438
</div>
3539
</SignIn>
3640

3741
<!-- GitHub Authentication - Using the SignIn component -->
3842
<SignIn provider="github" callbackUrl="/dashboard">
39-
<div slot="submitButton" class="btn flex justify-center items-center w-full bg-gray-800 py-2 sm:py-3 text-white text-sm sm:text-base">
40-
<span><img src="/images/github.svg" alt="GitHub" class="mr-2 sm:mr-3 h-5 w-5 sm:h-6 sm:w-6" /></span>
43+
<div
44+
slot="submitButton"
45+
class="btn flex w-full items-center justify-center bg-gray-800 py-2 text-sm text-white sm:py-3 sm:text-base"
46+
>
47+
<span
48+
><img
49+
src="/images/github.svg"
50+
alt="GitHub"
51+
class="mr-2 h-5 w-5 sm:mr-3 sm:h-6 sm:w-6"
52+
/></span
53+
>
4154
<span>Continue with GitHub</span>
4255
</div>
4356
</SignIn>
@@ -50,4 +63,4 @@
5063
width: 100% !important;
5164
height: auto !important;
5265
}
53-
</style>
66+
</style>

0 commit comments

Comments
 (0)