import React from "react";
import { getServerSession } from "next-auth";
import Logout from "./components/Logout";
import { headers } from "next/headers";
type Props = {
children: React.ReactNode;
};
const template = async ({ children }: Props) => {
console.log();
const isAuth = headers().get("X-Authenticated-User");
const session = await getServerSession();
console.log();
if (isAuth) {
console.log("YES YES");
}
console.log("session from template", isAuth);
return (
<div>
<nav>{isAuth !== "null" ? <Logout /> : <div>Login</div>}</nav>
{children}
</div>
);
};
export default template;
when I login i do router.push("/admin/");
but its not changing the login to logout until i refresh the page