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

36 lines
811 B

  1. import AppBar from "@/components/AppBar";
  2. import { getServerSession } from "next-auth";
  3. import { authOptions } from "@/config/authConfig";
  4. import { redirect } from "next/navigation";
  5. import Box from "@mui/material/Box";
  6. import { NAVIGATION_CONTENT_WIDTH } from "@/config/uiConfig";
  7. export default async function MainLayout({
  8. children,
  9. }: {
  10. children: React.ReactNode;
  11. }) {
  12. const session = await getServerSession(authOptions);
  13. if (!session?.user) {
  14. redirect("/login");
  15. }
  16. return (
  17. <>
  18. <AppBar
  19. profileName={session.user.name!}
  20. avatarImageSrc={session.user.image || undefined}
  21. />
  22. <Box
  23. component="main"
  24. sx={{
  25. marginInlineStart: { xs: 0, lg: NAVIGATION_CONTENT_WIDTH },
  26. }}
  27. >
  28. {children}
  29. </Box>
  30. </>
  31. );
  32. }