#Exclude footer and Header from login Page

1 messages · Page 1 of 1 (latest)

fathom dock
#

help

mighty smelt
#

remove them from the page :kappa:

#

(or useSearchParam/pathname to handle if it has to be display.. ?)

#
import ReduxProvider from "@/_store/provider";
import "./globals.css";
import { Inter } from "next/font/google";
import Header from "@/components/Header";
import Footer from "@/components/Footer";
import { getServerSession } from "next-auth";
import { options } from "@/utils/options";
import { usePathname } from "next/navigation"

const inter = Inter({ subsets: ["latin"] });

export const metadata = {
  title: "Create Next App",
  description: "Generated by create next app",
};

export default async function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  const session = await getServerSession(options);
  const isLoggedIn = session?.user;
  
  const path = usePathname()

  return (
    <html lang="en">
      <body className={inter.className}>
        <ReduxProvider>
          <main className="flex flex-col min-h-screen">
            <div className="flex-[0.1]">
              { path === "/" && <Header data={session?.user} />}
            </div>
            <div className="flex-grow">{children}</div>
            <div className="mt-auto">
               { path === "/" && <Footer />}
            </div>
          </main>
        </ReduxProvider>
      </body>
    </html>
  );
}
}

@fathom dock 🤓

#

idk if it's the best solution tho.. but might works :kappa:

ripe fractal
#

this was answered for you already

#

route groups

mighty smelt
#

that's probably a better idea.. because i didnt well understand how all app is working

fathom dock