From ce1dab01b4237bf06a7376d58bdf9e24976b1e15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Humberto=20Rodr=C3=ADguez=20A=2E?= Date: Wed, 22 Nov 2023 15:21:39 +0000 Subject: [PATCH] Add explicit types to avoid 'any' warnings --- sveltekit/github-oauth/src/routes/login/+page.server.ts | 3 ++- sveltekit/github-oauth/src/routes/login/github/+server.ts | 3 ++- .../github-oauth/src/routes/login/github/callback/+server.ts | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sveltekit/github-oauth/src/routes/login/+page.server.ts b/sveltekit/github-oauth/src/routes/login/+page.server.ts index dffb4b4..3bc4d86 100644 --- a/sveltekit/github-oauth/src/routes/login/+page.server.ts +++ b/sveltekit/github-oauth/src/routes/login/+page.server.ts @@ -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 {}; diff --git a/sveltekit/github-oauth/src/routes/login/github/+server.ts b/sveltekit/github-oauth/src/routes/login/github/+server.ts index 1d153d5..1446903 100644 --- a/sveltekit/github-oauth/src/routes/login/github/+server.ts +++ b/sveltekit/github-oauth/src/routes/login/github/+server.ts @@ -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, { diff --git a/sveltekit/github-oauth/src/routes/login/github/callback/+server.ts b/sveltekit/github-oauth/src/routes/login/github/callback/+server.ts index 80a20a2..9813ed0 100644 --- a/sveltekit/github-oauth/src/routes/login/github/callback/+server.ts +++ b/sveltekit/github-oauth/src/routes/login/github/callback/+server.ts @@ -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, {