File size: 478 Bytes
d2226ad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// const API_BASE = import.meta.env.VITE_API_BASE || "http://localhost:8000";
const API_BASE = import.meta.env.VITE_API_BASE || "";
export async function getSkyData(lat, lon, time) {
  const res = await fetch(`${API_BASE}/api/sky`, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      latitude: lat,
      longitude: lon,
      time: time,
    }),
  });

  if (!res.ok) throw new Error("API error");
  return res.json();
}