26 lines
798 B
JavaScript
26 lines
798 B
JavaScript
import axios from 'axios';
|
|
|
|
const JINGROW_SERVER_URL = process.env.JINGROW_SERVER_URL;
|
|
|
|
export async function GET(request) {
|
|
try {
|
|
const { searchParams } = new URL(request.url);
|
|
const pagetype = searchParams.get('pagetype');
|
|
const slug = searchParams.get('slug');
|
|
if (!pagetype || !slug) {
|
|
return Response.json({ error: '缺少pagetype或slug参数' }, { status: 400 });
|
|
}
|
|
const response = await axios.get(
|
|
`${JINGROW_SERVER_URL}/api/action/jsite.api.v1.get_detailview_data`,
|
|
{ params: { pagetype, slug } }
|
|
);
|
|
const data = response.data.message?.data || {};
|
|
return Response.json({ data });
|
|
} catch (error) {
|
|
return Response.json(
|
|
{ error: error.message, detail: error?.response?.data || null },
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|