|
|
@ -1,5 +1,4 @@ |
|
|
import { NextRequest, NextResponse } from "next/server"; |
|
|
import { NextRequest, NextResponse } from "next/server"; |
|
|
import { requireLogin } from "@/app/api/_auth"; |
|
|
|
|
|
const UPSTREAM_RECOMMEND_BANNER_LIST_PATH = |
|
|
const UPSTREAM_RECOMMEND_BANNER_LIST_PATH = |
|
|
"/api_client/anime/recommendBanner/list"; |
|
|
"/api_client/anime/recommendBanner/list"; |
|
|
|
|
|
|
|
|
@ -15,8 +14,6 @@ export async function GET(request: NextRequest) { |
|
|
{ status: 500 }, |
|
|
{ status: 500 }, |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
const { token } = requireLogin(request); |
|
|
|
|
|
console.log("token", token); |
|
|
|
|
|
const upstreamUrl = new URL(UPSTREAM_RECOMMEND_BANNER_LIST_PATH, baseUrl); |
|
|
const upstreamUrl = new URL(UPSTREAM_RECOMMEND_BANNER_LIST_PATH, baseUrl); |
|
|
upstreamUrl.searchParams.set( |
|
|
upstreamUrl.searchParams.set( |
|
|
"origin", |
|
|
"origin", |
|
|
@ -25,9 +22,6 @@ export async function GET(request: NextRequest) { |
|
|
|
|
|
|
|
|
const response = await fetch(upstreamUrl, { |
|
|
const response = await fetch(upstreamUrl, { |
|
|
method: "GET", |
|
|
method: "GET", |
|
|
headers: { |
|
|
|
|
|
authorization: `Bearer ${token}`, |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
}); |
|
|
const body = await response.text(); |
|
|
const body = await response.text(); |
|
|
console.log("Upstream response body:", body); |
|
|
console.log("Upstream response body:", body); |
|
|
|