import type { Metadata } from "next";
import { checkAccessTokenIsValid } from "@/apicalls/cookies/token";
import { redirect } from "next/navigation";

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

export default async function DashLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  const token_is_valid = await checkAccessTokenIsValid();
  if (!token_is_valid) {
    redirect("/auth/login");
  }
  return (
    <div className="min-h-screen min-w-screen flex h-screen w-screen overflow-hidden">
      {children}
    </div>
  );
}
