mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
fix: route
This commit is contained in:
parent
51e66ef2f1
commit
72f00ac8b3
@ -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) {
|
export const GET = auth(async function GET(req) {
|
||||||
if (!req.auth && getEnv("SitePassword")) {
|
if (!req.auth && getEnv("SitePassword")) {
|
||||||
redirect("/");
|
redirect("/");
|
||||||
|
Loading…
Reference in New Issue
Block a user