From bfc1211435a2f722386299a319a999c74e521cab Mon Sep 17 00:00:00 2001 From: netervati Date: Mon, 17 Jun 2024 17:38:07 +0800 Subject: [PATCH] Remove redundancy in auth --- server/middleware/auth.ts | 4 +--- server/services/supabaseService.ts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/server/middleware/auth.ts b/server/middleware/auth.ts index 7aa3bfd..49c5c22 100644 --- a/server/middleware/auth.ts +++ b/server/middleware/auth.ts @@ -1,7 +1,5 @@ import { serverSupabaseUser } from '#supabase/server'; export default defineEventHandler(async (event) => { - const user = await serverSupabaseUser(event); - - event.context.auth = { user }; + await serverSupabaseUser(event); }); diff --git a/server/services/supabaseService.ts b/server/services/supabaseService.ts index 81a4097..3308ef8 100644 --- a/server/services/supabaseService.ts +++ b/server/services/supabaseService.ts @@ -9,6 +9,6 @@ export default class SupabaseService { constructor(event: H3Event) { this.client = serverSupabaseServiceRole(event); - this.user = event.context.auth.user; + this.user = event.context._user; } }