Project setup

This commit is contained in:
Darren Clarke 2022-12-02 10:55:56 +00:00
parent 6c45dec07b
commit 95a21d6f50
29 changed files with 12083 additions and 77 deletions

21
lib/checkAuth.ts Normal file
View file

@ -0,0 +1,21 @@
import { GetServerSideProps, GetServerSidePropsContext } from "next";
import { getSession } from "next-auth/react";
export const checkAuth: GetServerSideProps = async (
context: GetServerSidePropsContext
) => {
const session = await getSession(context);
if (!session) {
return {
redirect: {
destination: "/login",
permanent: false,
},
};
}
return {
props: { session },
};
};