import axios from 'axios';
import { get_jingrow_api_headers } from '../auth';

const JINGROW_SERVER_URL = process.env.JINGROW_SERVER_URL;

export async function GET(request) {
  try {
    const response = await axios.get(
      `${JINGROW_SERVER_URL}/api/method/jsite.api.v1.get_site_settings`,
      { headers: get_jingrow_api_headers() }
    );
    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 }
    );
  }
} 