Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sveltekit/github-oauth/src/routes/login/+page.server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { redirect } from '@sveltejs/kit';
import type { PageServerLoad } from './$types';

export const load = async ({ locals }) => {
export const load: PageServerLoad = async ({ locals }) => {
const session = await locals.auth.validate();
if (session) throw redirect(302, '/');
return {};
Expand Down
3 changes: 2 additions & 1 deletion sveltekit/github-oauth/src/routes/login/github/+server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { dev } from '$app/environment';
import { githubAuth } from '$lib/server/lucia.js';
import type { RequestHandler } from './$types';

export const GET = async ({ cookies, locals }) => {
export const GET : RequestHandler = async ({ cookies, locals }) => {
const session = await locals.auth.validate();
if (session) {
return new Response(null, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { auth, githubAuth } from '$lib/server/lucia.js';
import { OAuthRequestError } from '@lucia-auth/oauth';
import type { RequestHandler } from '../$types';

export const GET = async ({ url, cookies, locals }) => {
export const GET: RequestHandler = async ({ url, cookies, locals }) => {
const session = await locals.auth.validate();
if (session) {
return new Response(null, {
Expand Down