25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

33 lines
700 B

  1. import type { Metadata } from "next";
  2. import AppBar from "@/components/AppBar";
  3. import { getServerSession } from "next-auth";
  4. import { authOptions } from "@/config/authConfig";
  5. import { redirect } from "next/navigation";
  6. export const metadata: Metadata = {
  7. title: "Dashboard",
  8. };
  9. export default async function DashboardLayout({
  10. children,
  11. }: {
  12. children: React.ReactNode;
  13. }) {
  14. const session = await getServerSession(authOptions);
  15. console.log(session);
  16. if (!session?.user) {
  17. redirect("/login");
  18. }
  19. return (
  20. <>
  21. <AppBar
  22. profileName={session.user.name!}
  23. avatarImageSrc={session.user.image || undefined}
  24. />
  25. <main>{children}</main>
  26. </>
  27. );
  28. }