diff --git a/pages/sessions/cookies/nextjs.md b/pages/sessions/cookies/nextjs.md index f92c174..068b743 100644 --- a/pages/sessions/cookies/nextjs.md +++ b/pages/sessions/cookies/nextjs.md @@ -170,14 +170,14 @@ This function can be used in server components, server actions, and route handle import { redirect } from "next/navigation"; async function Page() { - const { user } = await getCurrentUser(); + const { user } = await getCurrentSession(); if (user === null) { return redirect("/login"); } async function action() { "use server"; - const { user } = await getCurrentUser(); + const { user } = await getCurrentSession(); if (user === null) { return redirect("/login"); } diff --git a/pages/tutorials/github-oauth/nextjs.md b/pages/tutorials/github-oauth/nextjs.md index fe5f008..e2d7b18 100644 --- a/pages/tutorials/github-oauth/nextjs.md +++ b/pages/tutorials/github-oauth/nextjs.md @@ -179,14 +179,14 @@ export async function GET(request: Request): Promise { ## Validate requests -Use the `getCurrentUser()` function from the [Session cookies in Next.js](/sessions/cookies/nextjs) page to get the current user and session. +Use the `getCurrentSession()` function from the [Session cookies in Next.js](/sessions/cookies/nextjs) page to get the current user and session. ```tsx import { redirect } from "next/navigation"; -import { getCurrentUser } from "@/lib/session"; +import { getCurrentSession } from "@/lib/session"; export default async function Page() { - const { user } = await getCurrentUser(); + const { user } = await getCurrentSession(); if (user === null) { return redirect("/login"); } diff --git a/pages/tutorials/google-oauth/nextjs.md b/pages/tutorials/google-oauth/nextjs.md index 4f88f3b..0907263 100644 --- a/pages/tutorials/google-oauth/nextjs.md +++ b/pages/tutorials/google-oauth/nextjs.md @@ -181,14 +181,14 @@ export async function GET(request: Request): Promise { ## Validate requests -Use the `getCurrentUser()` function from the [Session cookies in Next.js](/sessions/cookies/nextjs) page to get the current user and session. +Use the `getCurrentSession()` function from the [Session cookies in Next.js](/sessions/cookies/nextjs) page to get the current user and session. ```tsx import { redirect } from "next/navigation"; -import { getCurrentUser } from "@/lib/session"; +import { getCurrentSession } from "@/lib/session"; export default async function Page() { - const { user } = await getCurrentUser(); + const { user } = await getCurrentSession(); if (user === null) { return redirect("/login"); }