Skip to content

Commit 1465a13

Browse files
committed
Make locals.auth nullable
1 parent d1ddf0d commit 1465a13

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/lib/actions/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { auth } from "$lib/server/lucia";
66

77
export const actions: Actions = {
88
logout: async ({ locals }) => {
9-
const session = await locals.auth.validate();
9+
const session = await locals.auth?.validate();
1010

1111
if (!session) return fail(401);
1212

src/routes/+layout.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { LayoutServerLoad } from "./$types";
22

33
export const load: LayoutServerLoad = async ({ locals }) => {
4-
const session = await locals.auth.validate();
4+
const session = await locals.auth?.validate();
55

66
if (!session) return;
77

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { dev } from "$app/environment";
22
import { spotifyAuth } from "$lib/server/lucia.js";
33

44
export const GET = async ({ cookies, locals }) => {
5-
const session = await locals.auth.validate();
5+
const session = await locals.auth?.validate();
66

77
if (session) {
88
return new Response(null, {

src/routes/login/spotify/callback/+server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ async function getUser({
2727
}
2828

2929
export const GET = async ({ url, cookies, locals }) => {
30-
const session = await locals.auth.validate();
30+
const session = await locals.auth?.validate();
3131
if (session) {
3232
return new Response(null, {
3333
status: 302,

0 commit comments

Comments
 (0)