mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-29 16:14:43 +00:00
Edit & Delete Site
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import prisma from "@/app/prisma";
|
||||
|
||||
interface Body {
|
||||
siteId: string;
|
||||
}
|
||||
|
||||
export async function DELETE(request: NextRequest) {
|
||||
const body: Body = await request.json();
|
||||
const { siteId } = body;
|
||||
const searchParams = request.nextUrl.searchParams;
|
||||
const siteId = searchParams.get("siteId");
|
||||
|
||||
try {
|
||||
const site = await prisma.site.delete({
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import prisma from "@/app/prisma";
|
||||
import { Network } from "@/app/types";
|
||||
|
||||
interface Body {
|
||||
siteId: string;
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
networks: Network[];
|
||||
}
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
const body: Body = await request.json();
|
||||
const { siteId, name, description } = body;
|
||||
const { id, name, description, networks } = body;
|
||||
|
||||
try {
|
||||
const site = await prisma.site.update({
|
||||
where: { id: Number(siteId) },
|
||||
where: { id: Number(id) },
|
||||
data: { name, description },
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user