MCPcopy Create free account
hub / github.com/alanagoyal/docbase / createClient

Function createClient

utils/supabase/server.ts:4–34  ·  view source on GitHub ↗
(cookieStore = cookies())

Source from the content-addressed store, hash-verified

2import { cookies } from 'next/headers'
3
4export 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}

Callers 15

RootLayoutFunction · 0.90
ContactsFunction · 0.90
DocumentsPageFunction · 0.90
GETFunction · 0.90
LinksPageFunction · 0.90
LinkFunction · 0.90
generateMetadataFunction · 0.90
DocFunction · 0.90
EditLinkFunction · 0.90
signupFunction · 0.90
MessagesFunction · 0.90
POSTFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected