/* This example requires Tailwind CSS v2.0+ */
import { Fragment } from "react";
import Image from "next/image";
import { Disclosure, Menu, Transition } from "@headlessui/react";
import { MenuIcon, XIcon } from "@heroicons/react/outline";
import { signIn, signOut, useSession } from "next-auth/react";
import Loading from "../Loading";
function classNames(...classes) {
return classes.filter(Boolean).join(" ");
}
export default function Layout({ children }) {
const { data: session, status } = useSession();
if (status === "loading") {
return ;
}
if (!session) {
signIn();
return
You need to be authenticated to view this page.
;
}
return (
{({ open }) => (
<>
{/* Profile dropdown */}
{/* Mobile menu button */}
Open main menu
{open ? (
) : (
)}
>
)}
{children}
);
}