import { HeadSeo } from "@components/seo/head-seo";
import Link from "next/link";
import { getCsrfToken } from "next-auth/client";
import { getSession } from "@lib/auth";
export default function Login({ csrfToken }) {
return (
Sign in to your account
Don't have an account? {/* replace this with your account creation flow */}
Create an account
);
}
Login.getInitialProps = async (context) => {
const { req, res } = context;
const session = await getSession({ req });
if (session) {
res.writeHead(302, { Location: "/" });
res.end();
return;
}
return {
csrfToken: await getCsrfToken(context),
};
};