This commit is contained in:
oiov
2024-10-30 16:03:13 +08:00
parent daf06a32c8
commit 413abe900b
6 changed files with 41 additions and 53 deletions
+1 -4
View File
@@ -20,9 +20,6 @@ export async function GET(req: Request) {
return Response.json(data);
} catch (error) {
return Response.json(error?.statusText || error, {
status: error.status || 500,
statusText: error.statusText || "Server error",
});
return Response.json({ statusText: "Server error" }, { status: 500 });
}
}
+1 -6
View File
@@ -8,7 +8,6 @@ export async function POST(req: Request) {
if (user.role !== "ADMIN") {
return Response.json("Unauthorized", {
status: 401,
statusText: "Unauthorized",
});
}
@@ -26,14 +25,10 @@ export async function POST(req: Request) {
if (!res?.id) {
return Response.json("An error occurred", {
status: 400,
statusText: "An error occurred",
});
}
return Response.json("success");
} catch (error) {
return Response.json(error?.statusText || error, {
status: error.status || 500,
statusText: error.statusText || "Server error",
});
return Response.json({ statusText: "Server error" }, { status: 500 });
}
}