+ Password Change, +- Settings NAV, fixed bg missing
This commit is contained in:
30
apps/hub/app/(app)/settings/actions.ts
Normal file
30
apps/hub/app/(app)/settings/actions.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
"use server";
|
||||
import { Prisma, PrismaClient } from "@repo/db";
|
||||
import { getServerSession } from "../../api/auth/[...nextauth]/auth";
|
||||
|
||||
export const unlinkDiscord = async (userId: string) => {
|
||||
const client = new PrismaClient();
|
||||
await client.discordAccount.deleteMany({
|
||||
where: {
|
||||
userId,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const updateUser = async (changes: Prisma.UserUpdateInput) => {
|
||||
const session = await getServerSession();
|
||||
if (!session) return null;
|
||||
|
||||
const client = new PrismaClient();
|
||||
|
||||
await client.user.update({
|
||||
where: {
|
||||
id: session.user.id,
|
||||
},
|
||||
data: changes,
|
||||
});
|
||||
};
|
||||
|
||||
export const changePassword = async (changes: Prisma.UserUpdateInput) => {
|
||||
// TODO: Add password change logic
|
||||
};
|
||||
Reference in New Issue
Block a user