fix server session problem;
optimize
This commit is contained in:
@ -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");
|
||||
|
||||
|
Reference in New Issue
Block a user