Good idea to mix prisma and trpc on the [...nextauth].ts file or should call a function from

So I have something like this:
CredentialsProvider({
name: "credentials",
credentials: {
email: {
label: "email",
type: "text",
placeholder: "[email protected]",
},
password: {
label: "password",
type: "password",
},
},
authorize: async (credentials: any) => {
const user = await prisma.user.findFirst({
where: {
email: credentials.email,
password: credentials.password,
},
});

if (user !== null) {
return user;
} else {
throw new Error(
"User does not exists. Please make sure you insert the correct email & password."
);
}
},
}),
],
pages: {
signIn: "/signin",
}
CredentialsProvider({
name: "credentials",
credentials: {
email: {
label: "email",
type: "text",
placeholder: "[email protected]",
},
password: {
label: "password",
type: "password",
},
},
authorize: async (credentials: any) => {
const user = await prisma.user.findFirst({
where: {
email: credentials.email,
password: credentials.password,
},
});

if (user !== null) {
return user;
} else {
throw new Error(
"User does not exists. Please make sure you insert the correct email & password."
);
}
},
}),
],
pages: {
signIn: "/signin",
}
Its my first time using NextAuth and im thinking if doing something like this inside this file is a good idea or if this logic should be inside trpc method ? Can anyone give me any tip / idea please?
1 Reply
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server