import { NextResponse } from "next/server";
import axios from "axios";

export async function POST(request) {
  try {
    const body = await request.json();

    const headers = {
      // 'Authorization': `Bearer ${body.token}`,
      'ngrok-skip-browser-warning': 'true',
    };
    const loginRes = await axios.get(
      `${process.env.NEXT_PUBLIC_KIOSK_URL2}/status?kioskName=${body.kioskName}`,
      { headers }
    );

    console.log("Status response:", loginRes.data);


    return NextResponse.json(loginRes.data);
  } catch (error) {

    // console.error(
    //   "Login Error:",
    //   error?.response?.data || error.message || error
    // );
    return NextResponse.json(
      { error: "Something went wrong", detail: error.message },
      { status: error.status }
    );
  }
}