Skip to content

Commit

Permalink
Refactor: moved the auth options and version to fix build errors - by…
Browse files Browse the repository at this point in the history
… vyshnav
  • Loading branch information
joywin2003 committed Sep 11, 2024
1 parent 7a23fa8 commit b20fadd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions src/app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import { authOptions } from "./options";
import { handlers } from "@/lib/auth-options";

import NextAuth from "next-auth";

export const handlers = NextAuth(authOptions);

export { handlers as GET, handlers as POST };
export { handlers as GET, handlers as POST };
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import NextAuth, { DefaultSession, type NextAuthOptions, type Session as NextAuthSession } from "next-auth";
import { DefaultSession, type NextAuthOptions, type Session as NextAuthSession } from "next-auth";
import NextAuth from "next-auth/next";
import GoogleProvider from "next-auth/providers/google";
import { PrismaAdapter } from "@next-auth/prisma-adapter";
import prisma from "@/server/db";
import { UserRoleType } from "@/types";
import { JWT } from "next-auth/jwt";


declare module "next-auth" {
interface Session {
user: {
Expand Down Expand Up @@ -58,4 +58,4 @@ export const authOptions: NextAuthOptions = {
// debug: process.env.NODE_ENV === "development",
};

export default NextAuth(authOptions);
export const handlers = NextAuth(authOptions);
4 changes: 2 additions & 2 deletions src/lib/get-server-session.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getServerSession } from "next-auth";
import { authOptions } from "@/app/api/auth/[...nextauth]/options";
import { authOptions } from "@/lib/auth-options";

export async function getServerSideSession() {
return await getServerSession(authOptions);
return await getServerSession(authOptions);
}

0 comments on commit b20fadd

Please sign in to comment.