From 64e5fd3354df94fbe179397c36acd3662d0c37b8 Mon Sep 17 00:00:00 2001 From: Nareshkumar Rao Date: Fri, 4 Apr 2025 23:38:08 +0200 Subject: [PATCH] fix --- src/app/blog/[[...tag]]/page.tsx | 2 +- src/app/blog/post/[slug]/page.tsx | 2 +- src/app/blog/write/[[...slug]]/page.tsx | 2 +- src/app/blog/write/action.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/blog/[[...tag]]/page.tsx b/src/app/blog/[[...tag]]/page.tsx index 6cee023..bc1b17d 100644 --- a/src/app/blog/[[...tag]]/page.tsx +++ b/src/app/blog/[[...tag]]/page.tsx @@ -31,7 +31,7 @@ export default async function Blog({ if (pageNumber > numberOfPages) { notFound(); } - const loggedIn = (await auth()) != null; + const loggedIn = (await auth())?.user != null; const tags = await getTags(loggedIn); return ( diff --git a/src/app/blog/post/[slug]/page.tsx b/src/app/blog/post/[slug]/page.tsx index 1e31b7d..1ca93f3 100644 --- a/src/app/blog/post/[slug]/page.tsx +++ b/src/app/blog/post/[slug]/page.tsx @@ -13,7 +13,7 @@ export default async function Post({ if (!post) { notFound(); } - const loggedIn = (await auth()) != null; + const loggedIn = (await auth())?.user != null; return ( <> diff --git a/src/app/blog/write/[[...slug]]/page.tsx b/src/app/blog/write/[[...slug]]/page.tsx index 0065ee2..002435d 100644 --- a/src/app/blog/write/[[...slug]]/page.tsx +++ b/src/app/blog/write/[[...slug]]/page.tsx @@ -9,7 +9,7 @@ export default async function WritePage({ }: { params: Promise<{ slug: string[] | undefined }>; }) { - if (!(await auth())) { + if ((await auth())?.user == null) { signIn(); } diff --git a/src/app/blog/write/action.ts b/src/app/blog/write/action.ts index d3d60e0..9ddb98e 100644 --- a/src/app/blog/write/action.ts +++ b/src/app/blog/write/action.ts @@ -14,7 +14,7 @@ export async function savePostServer( is_draft: boolean, existingSlug?: string ) { - if (!(await auth())) { + if ((await auth())?.user != null) { throw new Error("Not authenticated"); }