From 2b4b583fc278cd6ea48cb5df50143125166e6f9c Mon Sep 17 00:00:00 2001 From: psiddharthdesign <107192927+psiddharthdesign@users.noreply.github.com> Date: Mon, 22 Jul 2024 18:00:54 +0530 Subject: [PATCH] fix/ testing cookie fix --- .../user/createSupabaseUserRouteHandlerClient.ts | 14 ++++++-------- .../user/createSupabaseUserServerActionClient.ts | 14 ++++++-------- .../createSupabaseUserServerComponentClient.ts | 14 ++++++-------- .../user/supabaseUserClientComponentClient.ts | 14 ++++++-------- 4 files changed, 24 insertions(+), 32 deletions(-) diff --git a/src/supabase-clients/user/createSupabaseUserRouteHandlerClient.ts b/src/supabase-clients/user/createSupabaseUserRouteHandlerClient.ts index 9d47bff1..2a2d1dcc 100644 --- a/src/supabase-clients/user/createSupabaseUserRouteHandlerClient.ts +++ b/src/supabase-clients/user/createSupabaseUserRouteHandlerClient.ts @@ -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 diff --git a/src/supabase-clients/user/createSupabaseUserServerActionClient.ts b/src/supabase-clients/user/createSupabaseUserServerActionClient.ts index b76ffb8f..53453278 100644 --- a/src/supabase-clients/user/createSupabaseUserServerActionClient.ts +++ b/src/supabase-clients/user/createSupabaseUserServerActionClient.ts @@ -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( diff --git a/src/supabase-clients/user/createSupabaseUserServerComponentClient.ts b/src/supabase-clients/user/createSupabaseUserServerComponentClient.ts index ec07b675..83df9eee 100644 --- a/src/supabase-clients/user/createSupabaseUserServerComponentClient.ts +++ b/src/supabase-clients/user/createSupabaseUserServerComponentClient.ts @@ -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( diff --git a/src/supabase-clients/user/supabaseUserClientComponentClient.ts b/src/supabase-clients/user/supabaseUserClientComponentClient.ts index 285578a3..64fd2b5a 100644 --- a/src/supabase-clients/user/supabaseUserClientComponentClient.ts +++ b/src/supabase-clients/user/supabaseUserClientComponentClient.ts @@ -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