Skip to content

Commit

Permalink
session
Browse files Browse the repository at this point in the history
  • Loading branch information
wanghao1993 committed Sep 9, 2024
1 parent a3537df commit 207c7a5
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions app/api/blog/detail/route.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { BusinessCode, responseHandler } from "@/lib/fetch_utils";
import prisma from "@/lib/pg";
import { PostTypes } from "@/types/post";
import { getServerSession } from "next-auth";
import { getSession } from "next-auth/react";
import { authOptions } from "@/lib/auth_options";
import { message } from "antd";
import { z } from "zod";

export const dynamic = "force-dynamic";
Expand Down Expand Up @@ -64,7 +61,7 @@ export async function POST(req: Request, res: Response) {
const post = await prisma.post.findUnique({
where: { blog_key: body.blog_key },
});
if (post && session?.user) {
if (post && session) {
try {
const user = await prisma.user.findUnique({
where: { email: session.user.email as string },
Expand Down

0 comments on commit 207c7a5

Please sign in to comment.