mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-17 23:47:13 +00:00
Refactor hostServer assignment in PUT request to handle null values correctly
This commit is contained in:
parent
42e584a381
commit
f2535cd2b9
@ -25,11 +25,18 @@ export async function PUT(request: NextRequest) {
|
||||
return NextResponse.json({ error: "Server not found" }, { status: 404 });
|
||||
}
|
||||
|
||||
let newHostServer = hostServer;
|
||||
if (hostServer === null) {
|
||||
newHostServer = 0;
|
||||
} else {
|
||||
newHostServer = hostServer;
|
||||
}
|
||||
|
||||
const updatedServer = await prisma.server.update({
|
||||
where: { id },
|
||||
data: {
|
||||
host,
|
||||
hostServer,
|
||||
hostServer: newHostServer,
|
||||
name,
|
||||
os,
|
||||
ip,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user