-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
14 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,30 @@ | ||
"use server" | ||
'use server'; | ||
|
||
import { createServerClient } from '@supabase/ssr' | ||
import { cookies } from 'next/headers' | ||
import { createServerClient } from '@supabase/ssr'; | ||
import { cookies } from 'next/headers'; | ||
import { Database } from '@/types/database'; | ||
|
||
export async function createClient() { | ||
const cookieStore = await cookies() | ||
const cookieStore = await cookies(); | ||
|
||
return createServerClient<Database>( | ||
process.env.NEXT_PUBLIC_SUPABASE_URL!, | ||
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, | ||
{ | ||
cookies: { | ||
getAll() { | ||
return cookieStore.getAll() | ||
return cookieStore.getAll(); | ||
}, | ||
setAll(cookiesToSet) { | ||
try { | ||
cookiesToSet.forEach(({ name, value, options }) => | ||
cookieStore.set(name, value, options) | ||
) | ||
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. | ||
} | ||
}, | ||
}, | ||
} | ||
) | ||
} | ||
}, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { Database } from '@/types/database'; | ||
|
||
export type Town = Database['public']['Tables']['towns']['Row']; | ||
export type Town = Database['public']['Tables']['towns']['Row']; |