mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-17 15:36:50 +00:00
Get Site API Route
This commit is contained in:
parent
afd0b65f8c
commit
75e324701a
16
app/api/sites/get/route.ts
Normal file
16
app/api/sites/get/route.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import prisma from "@/app/prisma";
|
||||
|
||||
interface QueryParams {
|
||||
siteId: string;
|
||||
}
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const { siteId } = request.nextUrl.searchParams as unknown as QueryParams;
|
||||
const site = await prisma.site.findUnique({
|
||||
where: {
|
||||
id: Number(siteId),
|
||||
},
|
||||
});
|
||||
return NextResponse.json(site);
|
||||
}
|
||||
@ -1,6 +1,5 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import prisma from "@/app/prisma";
|
||||
import Fuse from "fuse.js";
|
||||
|
||||
interface QueryParams {
|
||||
currentPage: number;
|
||||
|
||||
@ -38,6 +38,6 @@ export default function Dashboard() {
|
||||
if (loading) {
|
||||
return <Loading />;
|
||||
} else {
|
||||
return <SitePage username={username} name={name} siteId={siteId} />;
|
||||
return <SitePage username={username} name={name} siteId={siteId as string} />;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user