build fix
This commit is contained in:
parent
e280e2bce1
commit
bafea2c986
22
lib/auth.ts
22
lib/auth.ts
@ -2,18 +2,8 @@ import { NextAuthOptions } from 'next-auth';
|
|||||||
import CredentialsProvider from 'next-auth/providers/credentials';
|
import CredentialsProvider from 'next-auth/providers/credentials';
|
||||||
import { prisma } from '@/lib/prisma';
|
import { prisma } from '@/lib/prisma';
|
||||||
|
|
||||||
// Extend the built-in User type
|
// We don't need to extend User or Session here as they're defined in types/next-auth.d.ts
|
||||||
declare module "next-auth" {
|
// Removing the conflicting declarations
|
||||||
interface User {
|
|
||||||
id: string;
|
|
||||||
email: string;
|
|
||||||
name?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Session {
|
|
||||||
user: User;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const authOptions: NextAuthOptions = {
|
export const authOptions: NextAuthOptions = {
|
||||||
providers: [
|
providers: [
|
||||||
@ -46,10 +36,16 @@ export const authOptions: NextAuthOptions = {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return a user object compatible with the User interface in types/next-auth.d.ts
|
||||||
return {
|
return {
|
||||||
id: user.id,
|
id: user.id,
|
||||||
email: user.email,
|
email: user.email,
|
||||||
name: user.email.split('@')[0]
|
name: user.email.split('@')[0],
|
||||||
|
first_name: '',
|
||||||
|
last_name: '',
|
||||||
|
username: user.email.split('@')[0],
|
||||||
|
role: ['user'],
|
||||||
|
image: null
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user