(cookieStore = cookies())
| 2 | import { cookies } from 'next/headers' |
| 3 | |
| 4 | export function createClient(cookieStore = cookies()) { |
| 5 | return createServerClient( |
| 6 | process.env.NEXT_PUBLIC_SUPABASE_URL!, |
| 7 | process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, |
| 8 | { |
| 9 | cookies: { |
| 10 | get(name: string) { |
| 11 | return cookieStore.get(name)?.value |
| 12 | }, |
| 13 | set(name: string, value: string, options: CookieOptions) { |
| 14 | try { |
| 15 | cookieStore.set({ name, value, ...options }) |
| 16 | } catch (error) { |
| 17 | // The `set` method was called from a Server Component. |
| 18 | // This can be ignored if you have middleware refreshing |
| 19 | // user sessions. |
| 20 | } |
| 21 | }, |
| 22 | remove(name: string, options: CookieOptions) { |
| 23 | try { |
| 24 | cookieStore.set({ name, value: '', ...options }) |
| 25 | } catch (error) { |
| 26 | // The `delete` method was called from a Server Component. |
| 27 | // This can be ignored if you have middleware refreshing |
| 28 | // user sessions. |
| 29 | } |
| 30 | }, |
| 31 | }, |
| 32 | } |
| 33 | ) |
| 34 | } |
no outgoing calls
no test coverage detected