mirror of
https://github.com/r-freeman/portfolio.git
synced 2025-07-13 16:10:20 +00:00
This commit is contained in:
parent
415fc84251
commit
47f73eb0e4
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,6 +4,7 @@ prisma/**/*
|
|||||||
.env
|
.env
|
||||||
|
|
||||||
supabase/
|
supabase/
|
||||||
|
!/lib/supabase
|
||||||
|
|
||||||
.idea/
|
.idea/
|
||||||
|
|
||||||
|
8
lib/supabase/client.ts
Normal file
8
lib/supabase/client.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import {createBrowserClient} from '@supabase/ssr'
|
||||||
|
|
||||||
|
export function createClient() {
|
||||||
|
return createBrowserClient(
|
||||||
|
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
||||||
|
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
|
||||||
|
)
|
||||||
|
}
|
29
lib/supabase/server.ts
Normal file
29
lib/supabase/server.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import { createServerClient } from '@supabase/ssr'
|
||||||
|
import { cookies } from 'next/headers'
|
||||||
|
|
||||||
|
export async function createClient() {
|
||||||
|
const cookieStore = await cookies()
|
||||||
|
|
||||||
|
return createServerClient(
|
||||||
|
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
||||||
|
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
|
||||||
|
{
|
||||||
|
cookies: {
|
||||||
|
getAll() {
|
||||||
|
return cookieStore.getAll()
|
||||||
|
},
|
||||||
|
setAll(cookiesToSet) {
|
||||||
|
try {
|
||||||
|
cookiesToSet.forEach(({ name, value, options }) =>
|
||||||
|
cookieStore.set(name, value, options)
|
||||||
|
)
|
||||||
|
} catch {
|
||||||
|
// The `setAll` method was called from a Server Component.
|
||||||
|
// This can be ignored if you have middleware refreshing
|
||||||
|
// user sessions.
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user