Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Commit

Permalink
🐎 use unstable_getServerSession
Browse files Browse the repository at this point in the history
use unstable_getServerSession

🐎 Performance
  • Loading branch information
TimMikeladze committed Dec 29, 2022
1 parent bd825b5 commit e65551b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/modules/auth/authenticate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NextApiRequest, NextApiResponse } from 'next';
import { Session } from 'next-auth';
import { getSession } from 'next-auth/react';
import { Session, unstable_getServerSession } from 'next-auth';
import { nextAuthConfig } from '@/pages/api/auth/[...nextauth]';

export const authenticate = async (args: {
req: NextApiRequest;
Expand All @@ -9,7 +9,11 @@ export const authenticate = async (args: {
let session: Session;

try {
session = await getSession({ req: args.req });
session = await unstable_getServerSession(
args.req,
args.res,
nextAuthConfig,
);
} catch (error) {
// log.error(error as any);
}
Expand Down

1 comment on commit e65551b

@vercel
Copy link

@vercel vercel bot commented on e65551b Dec 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.