重构大量文件
This commit is contained in:
@@ -6,8 +6,7 @@ export async function PUT(req: Request) {
|
||||
try {
|
||||
const { currentPassword, newPassword } = await req.json();
|
||||
|
||||
// Cast to any to bypass build error until server restart allows prisma generate to run
|
||||
const settings = await (prisma as any).globalSettings.findUnique({
|
||||
const settings = await prisma.globalSettings.findUnique({
|
||||
where: { id: "default" },
|
||||
});
|
||||
|
||||
@@ -22,13 +21,13 @@ export async function PUT(req: Request) {
|
||||
|
||||
const hashedPassword = await hashPassword(newPassword);
|
||||
|
||||
await (prisma as any).globalSettings.update({
|
||||
await prisma.globalSettings.update({
|
||||
where: { id: "default" },
|
||||
data: { password: hashedPassword },
|
||||
});
|
||||
|
||||
return NextResponse.json({ success: true });
|
||||
} catch (error) {
|
||||
} catch {
|
||||
return NextResponse.json({ error: "Failed to change password" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user