import { Inter } from 'next/font/google' import { headers } from 'next/headers' import { redirect } from 'next/navigation' import { getSession } from '@/lib/authActions' import RecoilRootWrapper from './RecoilWrapper' import UIProvider from './UIProvider' import { ToastContainer } from 'react-toastify' import Header from '@/components/header/Header' import QModal from '@/components/common/modal/QModal' import { QcastProvider } from './QcastProvider' import './globals.css' import '../styles/style.scss' const inter = Inter({ subsets: ['latin'] }) export const metadata = { title: 'Create Next App', description: 'Generated by create next app', } export default async function RootLayout({ children }) { const headersList = headers() const headerPathname = headersList.get('x-pathname') || '' // console.log('headerPathname:', headerPathname) // const isLoggedIn = await checkSession() const session = await getSession() console.log('session[layout]:', session) if (!headerPathname.includes('/login') && !session.isLoggedIn) { redirect('/login') } return ( {/*{headerPathname !== '/login' && }*/}
{children}
) }