fix: fetch data empty

This commit is contained in:
hamster1963 2024-10-24 14:35:15 +08:00
parent 1a3bc4650e
commit 9ab1cfff9d
3 changed files with 3 additions and 6 deletions

View File

@ -7,9 +7,8 @@ import { NextResponse } from "next/server";
export const dynamic = "force-dynamic"; export const dynamic = "force-dynamic";
interface NezhaDataResponse { interface NezhaDataResponse extends NezhaAPISafe {
error?: string; error?: string;
data?: NezhaAPISafe;
cause?: string; cause?: string;
code?: string; code?: string;
} }

View File

@ -9,7 +9,6 @@ export const dynamic = "force-dynamic";
interface NezhaDataResponse { interface NezhaDataResponse {
error?: string; error?: string;
data?: ServerMonitorChart;
cause?: string; cause?: string;
code?: string; code?: string;
} }

View File

@ -7,9 +7,8 @@ import { NextResponse } from "next/server";
export const dynamic = "force-dynamic"; export const dynamic = "force-dynamic";
interface NezhaDataResponse { interface NezhaDataResponse extends ServerApi {
error?: string; error?: string;
data?: ServerApi;
cause?: string; cause?: string;
code?: string; code?: string;
} }
@ -37,7 +36,7 @@ export const GET = auth(async function GET(req) {
{ status: 400 }, { status: 400 },
); );
} }
if (!response.data) { if (!response.result) {
return NextResponse.json({ cause: "fetch data empty" }, { status: 400 }); return NextResponse.json({ cause: "fetch data empty" }, { status: 400 });
} }
return NextResponse.json(response, { status: 200 }); return NextResponse.json(response, { status: 200 });