Project structure update

This commit is contained in:
Darren Clarke 2023-02-09 21:51:12 +00:00
parent 86c616de0a
commit e556cdceba
70 changed files with 4127 additions and 56 deletions

21
link/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 },
};
};