28 lines
735 B
TypeScript

import { NextResponse } from "next/server";
import { auth } from "@/app/(auth)/auth";
import { getThirdPartyImageMaterialPublicConfig } from "@/lib/agents/third-party-image-material-service";
function jsonNoStore(body: Parameters<typeof NextResponse.json>[0], init?: ResponseInit) {
return NextResponse.json(body, {
...init,
headers: {
"Cache-Control": "no-store, max-age=0",
...(init?.headers || {}),
},
});
}
export async function GET() {
const session = await auth();
if (!session?.user?.id) {
return jsonNoStore({ error: "未登录" }, { status: 401 });
}
const config = await getThirdPartyImageMaterialPublicConfig();
return jsonNoStore({
success: true,
data: config,
});
}