Revert all next-auth changes

This commit is contained in:
Jared Palmer 2023-06-21 14:19:13 -07:00
parent 6f51b01621
commit 8841f5570f
3 changed files with 18 additions and 11 deletions

15
auth.ts
View file

@ -1,25 +1,18 @@
import NextAuth, { type DefaultSession } from 'next-auth'
import NextAuth from 'next-auth'
import GitHub from 'next-auth/providers/github'
declare module 'next-auth' {
interface Session {
user: {
/** The user's id. */
id: string
} & DefaultSession['user']
}
}
export const {
handlers: { GET, POST },
auth,
CSRF_experimental
// @ts-ignore
} = NextAuth({
// @ts-ignore
providers: [GitHub],
callbacks: {
// @ts-ignore
jwt: async ({ token, profile }) => {
if (profile) {
if (profile?.id) {
token.id = profile.id
token.image = profile.picture
}

13
next-auth.d.ts vendored Normal file
View file

@ -0,0 +1,13 @@
import NextAuth, { DefaultSession } from 'next-auth'
declare module 'next-auth' {
/**
* Returned by `useSession`, `getSession` and received as a prop on the `SessionProvider` React Context
*/
interface Session {
user: {
/** The user's postal address. */
id: string
} & DefaultSession['user']
}
}

View file

@ -26,6 +26,7 @@
},
"include": [
"next-env.d.ts",
"next-auth.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"