19 lines
557 B
TypeScript
19 lines
557 B
TypeScript
// this file is a wrapper with defaults to be used in both API routes and `getServerSideProps` functions
|
|
import type {IronSessionOptions} from "iron-session";
|
|
import {User} from "@/interfaces/user";
|
|
|
|
export const sessionOptions: IronSessionOptions = {
|
|
password: process.env.SECRET_COOKIE_PASSWORD as string,
|
|
cookieName: "eCrop/ielts",
|
|
cookieOptions: {
|
|
secure: process.env.NODE_ENV === "production",
|
|
},
|
|
};
|
|
|
|
// This is where we specify the typings of req.session.*
|
|
declare module "iron-session" {
|
|
interface IronSessionData {
|
|
user?: User | null;
|
|
}
|
|
}
|