Update user in db using prisma
Unanswered
TK2 posted this in #help-forum
TK2OP
I have a simple profile page that renders a form that displays current email, username, etc that's looked up from prisma and then stored into session data in Nextjs.
I'm attempting to update the user in db with entered values in the form.
In my submit function I have something like
What's the correct way to approach this? Make an
I'm attempting to update the user in db with entered values in the form.
In my submit function I have something like
try {
const updateUser = await prisma.user.update({
where: {
username: username,
},
data: {
username: data.username,
},
});
} catch (error) {
console.log("error updating user", error);
}What's the correct way to approach this? Make an
update-user route and place the above inside of that?1 Reply
if you are using form then I would go with server actions.