From b0313a262e18d4f64668bb4cb29676c4ea264ae3 Mon Sep 17 00:00:00 2001 From: Charis <26616127+charislam@users.noreply.github.com> Date: Tue, 6 Aug 2024 14:15:38 -0400 Subject: [PATCH] fix(docs): update nextjs quickstart (#28404) Update quick start to use new SSR API. --- .../getting-started/quickstarts/nextjs.mdx | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/apps/docs/content/guides/getting-started/quickstarts/nextjs.mdx b/apps/docs/content/guides/getting-started/quickstarts/nextjs.mdx index 83917c4fc10..0fe94cd5c12 100644 --- a/apps/docs/content/guides/getting-started/quickstarts/nextjs.mdx +++ b/apps/docs/content/guides/getting-started/quickstarts/nextjs.mdx @@ -137,23 +137,16 @@ hideToc: true process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, { cookies: { - get(name: string) { - return cookieStore.get(name)?.value + getAll() { + return cookieStore.getAll() }, - set(name: string, value: string, options: CookieOptions) { + setAll(cookiesToSet) { try { - cookieStore.set({ name, value, ...options }) - } catch (error) { - // The `set` method was called from a Server Component. - // This can be ignored if you have middleware refreshing - // user sessions. - } - }, - remove(name: string, options: CookieOptions) { - try { - cookieStore.set({ name, value: '', ...options }) - } catch (error) { - // The `delete` method was called from a Server Component. + 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. }