Skip to content

Commit

Permalink
fix/ testing cookie fix
Browse files Browse the repository at this point in the history
  • Loading branch information
psiddharthdesign committed Jul 22, 2024
1 parent 9318fa6 commit 2b4b583
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ type CookieOptions = createRouteHandlerClientParams['cookieOptions'];

const isDevelopment = process.env.NODE_ENV === 'development';

const optionalCookieOptions: CookieOptions = isDevelopment
? undefined
: {
domain: '.digger.dev',
secure: false,
path: '/',
sameSite: 'lax',
};
const optionalCookieOptions: CookieOptions = {
domain: isDevelopment ? undefined : '.digger.dev',
secure: !isDevelopment,
path: '/',
sameSite: 'lax',
};

// Outstanding bug
//https://github.com/vercel/next.js/issues/45371
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ type CookieOptions = createServerActionClientParams['cookieOptions'];

const isDevelopment = process.env.NODE_ENV === 'development';

const optionalCookieOptions: CookieOptions = isDevelopment
? undefined
: {
domain: '.digger.dev',
secure: false,
path: '/',
sameSite: 'lax',
};
const optionalCookieOptions: CookieOptions = {
domain: isDevelopment ? undefined : '.digger.dev',
secure: !isDevelopment,
path: '/',
sameSite: 'lax',
};

export const createSupabaseUserServerActionClient = () =>
createServerActionClient<Database>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ type createServerComponentClientParams = NonNullable<
>;
type CookieOptions = createServerComponentClientParams['cookieOptions'];

const optionalCookieOptions: CookieOptions = isDevelopment
? undefined
: {
domain: '.digger.dev',
secure: false,
path: '/',
sameSite: 'lax',
};
const optionalCookieOptions: CookieOptions = {
domain: isDevelopment ? undefined : '.digger.dev',
secure: !isDevelopment,
path: '/',
sameSite: 'lax',
};

export const createSupabaseUserServerComponentClient = () =>
createServerComponentClient<Database>(
Expand Down
14 changes: 6 additions & 8 deletions src/supabase-clients/user/supabaseUserClientComponentClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ type createClientComponentClientParams = NonNullable<
>;
type CookieOptions = createClientComponentClientParams['cookieOptions'];

const optionalCookieOptions: CookieOptions = isDevelopment
? undefined
: {
domain: '.digger.dev',
secure: false,
path: '/',
sameSite: 'lax',
};
const optionalCookieOptions: CookieOptions = {
domain: isDevelopment ? undefined : '.digger.dev',
secure: !isDevelopment,
path: '/',
sameSite: 'lax',
};

// apologies for the name, but it's the best I could come up with as
// the util exported from @supabase/auth-helpers-nextjs is called
Expand Down

0 comments on commit 2b4b583

Please sign in to comment.