chore: remove middleware (#306)

#306
This commit is contained in:
Corbin Prebe 2024-11-24 22:41:48 -08:00
parent 3fb493f400
commit 1ce55e4091
2016 changed files with 23595 additions and 15662 deletions

35
lib/supabase/server.ts Normal file
View file

@ -0,0 +1,35 @@
import { createServerClient } from '@supabase/ssr'
import type { CookieOptions } from '@supabase/ssr'
import { cookies } from 'next/headers'
import { Database } from '../database.types'
export function createClient() {
return createServerClient<Database>(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
{
cookies: {
get(name: string) {
return cookies().get(name)?.value
},
set(name: string, value: string, options: CookieOptions) {
cookies().set({
name,
value,
...options,
path: options?.path ?? '/',
} as any) // Using any temporarily to bypass type checking
},
remove(name: string, options: CookieOptions) {
cookies().set({
name,
value: '',
...options,
path: options?.path ?? '/',
maxAge: 0,
} as any) // Using any temporarily to bypass type checking
},
},
}
)
}