25 lines
731 B
JavaScript
25 lines
731 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');
|
|
if (!pagetype) {
|
|
return Response.json({ error: '缺少pagetype参数' }, { status: 400 });
|
|
}
|
|
const response = await axios.get(
|
|
`${JINGROW_SERVER_URL}/api/method/jsite.api.v1.get_listview_data`,
|
|
{ params: { pagetype } }
|
|
);
|
|
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 }
|
|
);
|
|
}
|
|
}
|