fix server session problem;

optimize
This commit is contained in:
Dobromir Popov
2024-05-11 17:57:33 +03:00
parent ffe68b492b
commit e29807540f
3 changed files with 38 additions and 19 deletions

View File

@ -14,6 +14,8 @@ import { useSession, getSession } from 'next-auth/react';
import axiosInstance from 'src/axiosSecure';
import { toast } from 'react-toastify';
import LocalShippingIcon from '@mui/icons-material/LocalShipping';
import { getServerSession } from 'next-auth';
import { authOptions } from 'pages/api/auth/[...nextauth]';
export default function MySchedulePage({ assignments }) {
@ -160,7 +162,7 @@ export default function MySchedulePage({ assignments }) {
//get future assignments for the current user (session.user.id)
export const getServerSideProps = async (context) => {
const session = await getSession(context);
const session = await getServerSession(context.req, context.res, authOptions)
context.res.setHeader("Cache-Control", "s-maxage=1, stale-while-revalidate");