fix: route

This commit is contained in:
hamster1963 2024-10-24 21:30:48 +08:00
parent 51e66ef2f1
commit 72f00ac8b3

View File

@ -10,35 +10,6 @@ export const runtime = "edge";
export const GET = auth(async function GET(req) {
if (!req.auth && getEnv("SitePassword")) {
redirect("/");
}
try {
const data = await GetNezhaData();
return NextResponse.json(data, { status: 200 });
} catch (error) {
console.error("Error in GET handler:", error);
// @ts-ignore
const statusCode = error.statusCode || 500;
// @ts-ignore
const message = error.message || "Internal Server Error";
return NextResponse.json({ error: message }, { status: statusCode });
}
});
import { auth } from "@/auth";
import getEnv from "@/lib/env-entry";
import { GetNezhaData } from "@/lib/serverFetch";
import { redirect } from "next/navigation";
import { NextResponse } from "next/server";
export const dynamic = "force-dynamic";
export const runtime = "edge";
export const GET = auth(async function GET(req) {
if (!req.auth && getEnv("SitePassword")) {
redirect("/");