From 917a03f346ae740eeab952f111b4dd86ff7fd090 Mon Sep 17 00:00:00 2001 From: pilcrowOnPaper Date: Sun, 13 Oct 2024 00:33:16 +0900 Subject: [PATCH] fix inconsistency --- pages/sessions/cookies/nextjs.md | 4 ++-- pages/tutorials/github-oauth/nextjs.md | 6 +++--- pages/tutorials/google-oauth/nextjs.md | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) 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"); }