Replace createServerClient with createClient in multiple files (#30)
The `createServerClient` function has been replaced with the `createClient` function in the `server-actions.client.ts`, `route-handler.client.ts`, and `server-component.client.ts` files. This includes adding necessary import statements for `createClient` and adjusting the options passed to it, including `persistSession`, `detectSessionInUrl`, and `autoRefreshToken`.
This commit is contained in:
committed by
GitHub
parent
cbf116c688
commit
7f4bfb15e5
@@ -3,6 +3,8 @@ import 'server-only';
|
||||
import { unstable_noStore as noStore } from 'next/cache';
|
||||
import { cookies } from 'next/headers';
|
||||
|
||||
import { createClient } from '@supabase/supabase-js';
|
||||
|
||||
import type { CookieOptions } from '@supabase/ssr';
|
||||
import { createServerClient } from '@supabase/ssr';
|
||||
|
||||
@@ -31,11 +33,12 @@ export function getSupabaseRouteHandlerClient<GenericSchema = Database>(
|
||||
if (params.admin) {
|
||||
warnServiceRoleKeyUsage();
|
||||
|
||||
return createServerClient<GenericSchema>(keys.url, serviceRoleKey, {
|
||||
return createClient<GenericSchema>(keys.url, serviceRoleKey, {
|
||||
auth: {
|
||||
persistSession: false,
|
||||
autoRefreshToken: false,
|
||||
detectSessionInUrl: false,
|
||||
},
|
||||
cookies: {},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ import 'server-only';
|
||||
import { unstable_noStore as noStore } from 'next/cache';
|
||||
import { cookies } from 'next/headers';
|
||||
|
||||
import { createClient } from '@supabase/supabase-js';
|
||||
|
||||
import { createServerClient } from '@supabase/ssr';
|
||||
|
||||
import { Database } from '../database.types';
|
||||
@@ -35,11 +37,12 @@ export function getSupabaseServerActionClient<
|
||||
if (admin) {
|
||||
warnServiceRoleKeyUsage();
|
||||
|
||||
return createServerClient<GenericSchema>(keys.url, serviceRoleKey, {
|
||||
return createClient<GenericSchema>(keys.url, serviceRoleKey, {
|
||||
auth: {
|
||||
persistSession: false,
|
||||
detectSessionInUrl: false,
|
||||
autoRefreshToken: false,
|
||||
},
|
||||
cookies: {},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ import 'server-only';
|
||||
import { unstable_noStore as noStore } from 'next/cache';
|
||||
import { cookies } from 'next/headers';
|
||||
|
||||
import { createClient } from '@supabase/supabase-js';
|
||||
|
||||
import { createServerClient } from '@supabase/ssr';
|
||||
|
||||
import { Database } from '../database.types';
|
||||
@@ -30,12 +32,12 @@ export function getSupabaseServerComponentClient<GenericSchema = Database>(
|
||||
if (params.admin) {
|
||||
warnServiceRoleKeyUsage();
|
||||
|
||||
return createServerClient<GenericSchema>(keys.url, serviceRoleKey, {
|
||||
return createClient<GenericSchema>(keys.url, serviceRoleKey, {
|
||||
auth: {
|
||||
persistSession: false,
|
||||
autoRefreshToken: false,
|
||||
detectSessionInUrl: false,
|
||||
},
|
||||
cookies: {},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user