Skip to content

Commit

Permalink
feat : add update user query
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedrinvits committed Oct 18, 2024
1 parent 9251849 commit 418c537
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions data/updateUser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"use server"
import { db } from "@/lib/db";
import { User } from "@prisma/client";

export const updateUserInformations = async (
data : User,
) => {
try {

const updatedUser = await db.user.update({
where: { id: data.id },
data
});

return { updatedUser, success: "Informations updated", error: null };

} catch (error) {
console.error('Erro ao atualizar as informações:', error);
return { success: null, error: "Erro ao atualizar as informações." };
}
};

0 comments on commit 418c537

Please sign in to comment.