小编Vic*_*imi的帖子

错误:React Context 在服务器组件中不可用

请帮助我修复此错误:当我在 Next.js 中运行应用程序时,我收到以下消息:

错误:React Context 在服务器组件中不可用

import { useSession } from "next-auth/react";
import prisma from "@/lib/prisma";
import { ChatbotClient } from "./components/chatbot-client";
import { redirect } from "next/navigation";

interface ChatbotIdPageProps {
  params: {
    chatbotId: string;
  };
}

const ChatbotIdPage = async ({ params }: ChatbotIdPageProps) => {
  const { data: session } = useSession();

  if (!session?.user) {
    redirect("/demo");
  }

  const userId = JSON.stringify(session.user);

  const chatbot = await prisma.chatbot.findUnique({
    where: {
      id: params.chatbotId,
      userId: userId,
    },
  });

  return <ChatbotClient initialData={chatbot} />; …
Run Code Online (Sandbox Code Playgroud)

javascript authentication reactjs next.js next-auth

5
推荐指数
2
解决办法
6343
查看次数

如何更改 VS Code 行上的个人资料图片 责备注释

参考图像

我在 muy VS code 上看到过这张图片,但它看起来与我的 git hub 个人资料图片不一样,事实上我不知道他们从哪里得到这张图片,这只是我 7 年前的一张旧照片,请问有什么办法可以帮忙吗?

github visual-studio-code

2
推荐指数
1
解决办法
1127
查看次数